mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
CTest: migrate and deprecate existing selftest scripts
Replace the bash selftest plumbing with CTest. To use the selftests, build with -DLWS_WITH_MINIMAL_EXAMPLES=1 and `CTEST_OUTPUT_ON_FAILURE=1 make test` or just `make test`. To disable tests that require internet access, also give -DLWS_CTEST_INTERNET_AVAILABLE=0 Remove travis and appveyor scripts on master. Remove travis and appveyor decals on README.md.
This commit is contained in:
parent
af26f0c765
commit
9f1d019352
77 changed files with 879 additions and 1320 deletions
25
.sai.json
25
.sai.json
|
@ -14,6 +14,9 @@
|
|||
"linux-fedora-32-x86_64": {
|
||||
"build": "mkdir build destdir;cd build;export CCACHE_DISABLE=1;export SAI_CPACK=\"-G RPM\";cmake .. ${cmake} && make -j && make -j DESTDIR=../destdir install && ctest -j4 --output-on-failure ${cpack}"
|
||||
},
|
||||
"linux-centos-8-x8664": {
|
||||
"build": "mkdir build destdir;cd build;export CCACHE_DISABLE=1;export SAI_CPACK=\"-G RPM\";cmake .. ${cmake} && make -j && make -j DESTDIR=../destdir install && ctest -j4 --output-on-failure ${cpack}"
|
||||
},
|
||||
"linux-debian-buster-arm32": {
|
||||
"build": "mkdir build;cd build;export CCACHE_DISABLE=1;export SAI_CPACK=\"-G DEB\";cmake .. ${cmake} && make -j3 && make -j DESTDIR=../destdir install && ctest -j3 --output-on-failure ${cpack}",
|
||||
"default": false
|
||||
|
@ -44,20 +47,34 @@
|
|||
"cmake": "-DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=RELEASE -DLWS_WITH_GENCRYPTO=1 -DLWS_WITH_JOSE=1 -DLWS_WITH_SYS_ASYNC_DNS=1 -DLWS_WITH_SYS_NTPCLIENT=1",
|
||||
"platforms": "windows-10"
|
||||
},
|
||||
"secure-streams": {
|
||||
"cmake": "-DLWS_WITH_SECURE_STREAMS=1",
|
||||
"platforms": "windows-10"
|
||||
},
|
||||
"secure-streams-proxy": {
|
||||
"cmake": "-DLWS_WITH_SECURE_STREAMS=1 -DLWS_WITH_SECURE_STREAMS_PROXY_API=1",
|
||||
"platforms": "not windows-10"
|
||||
},
|
||||
"distro_recommended": {
|
||||
"cmake": "-DLWS_WITH_DISTRO_RECOMMENDED=1",
|
||||
"platforms": "not linkit-cross, not windows-10, linux-debian-buster-arm32",
|
||||
"cpack": "&& cpack $SAI_CPACK",
|
||||
"artifacts": "build/*.rpm, build/*.deb"
|
||||
"artifacts": "build/*.rpm, build/*.deb, build/*.zip"
|
||||
},
|
||||
"lwsws": {
|
||||
"cmake": "-DLWS_WITH_LWSWS=ON -DLWS_WITHOUT_EXTENSIONS=0 -DLWS_WITH_HTTP2=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_WITH_GENCRYPTO=1 -DLWS_WITH_JOSE=1 -DLWS_WITH_SYS_ASYNC_DNS=1 -DLWS_WITH_SYS_NTPCLIENT=1"
|
||||
"cmake": "-DLWS_WITH_LWSWS=ON -DLWS_WITHOUT_EXTENSIONS=0 -DLWS_WITH_HTTP2=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_WITH_GENCRYPTO=1 -DLWS_WITH_JOSE=1 -DLWS_WITH_SYS_ASYNC_DNS=1 -DLWS_WITH_SYS_NTPCLIENT=1",
|
||||
# no distro -devel package for libuv
|
||||
"platforms": "not linux-centos-8-x8664"
|
||||
},
|
||||
"lwsws2": {
|
||||
"cmake": "-DLWS_WITH_LWSWS=ON -DLWS_WITHOUT_EXTENSIONS=0 -DLWS_WITH_HTTP2=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_WITH_LWS_DSH=1"
|
||||
"cmake": "-DLWS_WITH_LWSWS=ON -DLWS_WITHOUT_EXTENSIONS=0 -DLWS_WITH_HTTP2=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_WITH_LWS_DSH=1",
|
||||
# no distro -devel package for libuv
|
||||
"platforms": "not linux-centos-8-x8664"
|
||||
},
|
||||
"mbedtls": {
|
||||
"cmake": "-DLWS_WITH_MBEDTLS=1 -DLWS_WITH_HTTP2=1 -DLWS_WITH_LWSWS=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DLWS_WITH_JOSE=1 -DCMAKE_BUILD_TYPE=DEBUG"
|
||||
"cmake": "-DLWS_WITH_MBEDTLS=1 -DLWS_WITH_HTTP2=1 -DLWS_WITH_LWSWS=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DLWS_WITH_JOSE=1 -DCMAKE_BUILD_TYPE=DEBUG",
|
||||
# no distro -devel package for mbedtls
|
||||
"platforms": "not linux-centos-8-x8664"
|
||||
},
|
||||
"noserver": {
|
||||
"cmake": "-DLWS_WITHOUT_SERVER=ON -DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
|
|
54
.travis.yml
54
.travis.yml
|
@ -1,54 +0,0 @@
|
|||
env:
|
||||
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||
# via the "travis encrypt" command using the project repo's public key
|
||||
global:
|
||||
- secure: "KhAdQ9ja+LBObWNQTYO7Df5J4DyOih6S+eerDMu8UPSO+CoWV2pWoQzbOfocjyOscGOwC+2PrrHDNZyGfqkCLDXg1BxynXPCFerHC1yc2IajvKpGXmAAygNIvp4KACDfGv/dkXrViqIzr/CdcNaU4vIMHSVb5xkeLi0W1dPnQOI="
|
||||
matrix:
|
||||
# 2019-09-30: travis build no longer has dbus
|
||||
# LWS_METHOD=lwsws CMAKE_ARGS="-DLWS_WITH_LWSWS=ON -DLWS_WITHOUT_EXTENSIONS=0 -DLWS_WITH_HTTP2=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_ROLE_DBUS=1 -DLWS_DBUS_INCLUDE2=/usr/lib/x86_64-linux-gnu/dbus-1.0/include/ -DLWS_WITH_GENCRYPTO=1 -DLWS_WITH_JOSE=1 -DLWS_WITH_SYS_ASYNC_DNS=1"
|
||||
# LWS_METHOD=lwsws2 CMAKE_ARGS="-DLWS_WITH_LWSWS=ON -DLWS_WITHOUT_EXTENSIONS=0 -DLWS_WITH_HTTP2=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_ROLE_DBUS=1 -DLWS_DBUS_INCLUDE2=/usr/lib/x86_64-linux-gnu/dbus-1.0/include/ -DLWS_WITH_LWS_DSH=1"
|
||||
- LWS_METHOD=lwsws CMAKE_ARGS="-DLWS_WITH_LWSWS=ON -DLWS_WITHOUT_EXTENSIONS=0 -DLWS_WITH_HTTP2=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_WITH_GENCRYPTO=1 -DLWS_WITH_JOSE=1 -DLWS_WITH_SYS_ASYNC_DNS=1 -DLWS_WITH_SYS_NTPCLIENT=1"
|
||||
- LWS_METHOD=lwsws2 CMAKE_ARGS="-DLWS_WITH_LWSWS=ON -DLWS_WITHOUT_EXTENSIONS=0 -DLWS_WITH_HTTP2=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_WITH_LWS_DSH=1"
|
||||
- LWS_METHOD=default CMAKE_ARGS="-DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
- LWS_METHOD=mbedtls CMAKE_ARGS="-DLWS_WITH_MBEDTLS=1 -DLWS_WITH_HTTP2=1 -DLWS_WITH_LWSWS=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DLWS_WITH_JOSE=1 -DCMAKE_BUILD_TYPE=DEBUG"
|
||||
- LWS_METHOD=ss CMAKE_ARGS="-DLWS_WITH_SECURE_STREAMS=1 -DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
- LWS_METHOD=ss+mbedtls CMAKE_ARGS="-DLWS_WITH_MBEDTLS=1 -DLWS_WITH_SECURE_STREAMS=1 -DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
- LWS_METHOD=noserver CMAKE_ARGS="-DLWS_WITHOUT_SERVER=ON -DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
- LWS_METHOD=noclient CMAKE_ARGS="-DLWS_WITHOUT_CLIENT=ON -DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
- LWS_METHOD=noext CMAKE_ARGS="-DLWS_WITHOUT_EXTENSIONS=ON -DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
- LWS_METHOD=nonetwork CMAKE_ARGS="-DLWS_WITH_NETWORK=0"
|
||||
- LWS_METHOD=libev CMAKE_ARGS="-DLWS_WITH_LIBEV=ON"
|
||||
- LWS_METHOD=ipv6 CMAKE_ARGS="-DLWS_IPV6=ON"
|
||||
- LWS_METHOD=nossl CMAKE_ARGS="-DLWS_WITH_SSL=OFF"
|
||||
- LWS_METHOD=nodaemon CMAKE_ARGS="-DLWS_WITHOUT_DAEMONIZE=ON"
|
||||
- LWS_METHOD=cgi CMAKE_ARGS="-DLWS_WITH_CGI=ON"
|
||||
- LWS_METHOD=nologs CMAKE_ARGS="-DLWS_WITH_NO_LOGS=ON"
|
||||
- LWS_METHOD=smp CMAKE_ARGS="-DLWS_MAX_SMP=32 -DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
- LWS_METHOD=nows CMAKE_ARGS="-DLWS_ROLE_WS=0"
|
||||
- LWS_METHOD=mqtt CMAKE_ARGS="-DLWS_ROLE_MQTT=1"
|
||||
- LWS_METHOD=threadpool CMAKE_ARGS="-DLWS_WITH_THREADPOOL=1 -DLWS_WITH_MINIMAL_EXAMPLES=1"
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
language: generic
|
||||
install:
|
||||
- ./scripts/travis_install.sh
|
||||
# - ./travis-tool.sh github_package jimhester/covr
|
||||
|
||||
#after_success:
|
||||
# - Rscript -e 'covr::coveralls()'
|
||||
|
||||
script:
|
||||
- ./scripts/travis_control.sh
|
||||
sudo: required
|
||||
dist: trusty
|
||||
addons:
|
||||
coverity_scan:
|
||||
project:
|
||||
name: "warmcat/libwebsockets"
|
||||
notification_email: andy@warmcat.com
|
||||
build_command_prepend: "mkdir build && cd build && cmake .."
|
||||
build_command: "cmake --build ."
|
||||
branch_pattern: coverity_scan
|
||||
|
|
@ -272,7 +272,8 @@ if(LWS_WITH_DISTRO_RECOMMENDED)
|
|||
set(LWS_WITH_STRUCT_JSON 1)
|
||||
set(LWS_WITH_STRUCT_SQLITE3 1)
|
||||
set(LWS_WITH_SPAWN 1)
|
||||
set(LWS_WITH_FSMOUNT 1)
|
||||
# libmount is problematic on Centos 8 / RHEL 8
|
||||
# set(LWS_WITH_FSMOUNT 1)
|
||||
set(LWS_ROLE_MQTT 1)
|
||||
set(LWS_WITH_SECURE_STREAMS 1)
|
||||
set(LWS_WITH_SECURE_STREAMS_PROXY_API 1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[](https://travis-ci.org/warmcat/libwebsockets) [](https://ci.appveyor.com/project/lws-team/libwebsockets) [](https://scan.coverity.com/projects/3576) [](https://bestpractices.coreinfrastructure.org/projects/2266) [](https://www.codacy.com/app/lws-team/libwebsockets?utm_source=github.com&utm_medium=referral&utm_content=warmcat/libwebsockets&utm_campaign=Badge_Grade) [](https://lgtm.com/projects/g/warmcat/libwebsockets/alerts/) [](https://lgtm.com/projects/g/warmcat/libwebsockets/context:cpp) [](https://lgtm.com/projects/g/warmcat/libwebsockets/context:javascript)
|
||||
[](https://libwebsockets.org/git/libwebsockets) [](https://scan.coverity.com/projects/3576) [](https://bestpractices.coreinfrastructure.org/projects/2266) [](https://www.codacy.com/app/lws-team/libwebsockets?utm_source=github.com&utm_medium=referral&utm_content=warmcat/libwebsockets&utm_campaign=Badge_Grade) [](https://lgtm.com/projects/g/warmcat/libwebsockets/alerts/) [](https://lgtm.com/projects/g/warmcat/libwebsockets/context:cpp) [](https://lgtm.com/projects/g/warmcat/libwebsockets/context:javascript)
|
||||
|
||||
# Libwebsockets
|
||||
|
||||
|
|
|
@ -1,28 +1,47 @@
|
|||
# Some notes for the windows jungle
|
||||
|
||||
This was how I compiled libwebsockets in windows March 2020.
|
||||
This was how I compiled libwebsockets starting from a blank windows install
|
||||
in March - April 2020. Doing this on a linux distro is way simpler and quicker
|
||||
than all this!
|
||||
|
||||
## OpenSSL
|
||||
## Notes on vm installation
|
||||
|
||||
### Installing prebuilt libs
|
||||
### Disk size
|
||||
|
||||
I used the 1.1.1d (the latest) libs from here, as recommended on the OpenSSL site
|
||||
For building you'll need 40GB+ available for the guest storage.
|
||||
|
||||
[overbyte.eu](https:..wiki.overbyte.eu/wiki/index.php/ICS_Download#Download_OpenSSL_Binaries_.28required_for_SSL-enabled_components.29)
|
||||
### Required: Windows product key
|
||||
|
||||
I had to use procmon64 (windows' strace) to establish that these libraries are
|
||||
looking for a cert bundle at "C:\Program Files\Common Files\SSL\cert.pem"... it's not
|
||||
included in the zip file from the above, so...
|
||||
Assuming like me the first thing you do with a new laptop is install Linux over
|
||||
the windows it came with, you can recover your 'windows tax' windows product key
|
||||
from your device typically using `sudo strings /sys/firmware/acpi/tables/MSDM`,
|
||||
and use that for your VM install.
|
||||
|
||||
### Installing a cert bundle
|
||||
### Required: Spice guest
|
||||
|
||||
You can get a trusted cert bundle from here
|
||||
To have shared clipboard, and for windows video driver to match your vm window
|
||||
resolution, you must install spice guest tools inside the windows VM. It also
|
||||
installs some virtio pieces you will want.
|
||||
|
||||
[drwetter/testssl cert bundle](https://raw.githubusercontent.com/drwetter/testssl.sh/3.1dev/etc/Microsoft.pem)
|
||||
https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe
|
||||
|
||||
Save it into `C:\Program Files\Common Files\SSL\cert.pem` where openssl will be able to see it.
|
||||
### Blood-pressure reduction: Firefox
|
||||
|
||||
### Installing cmake
|
||||
https://www.mozilla.org/en-US/exp/firefox/
|
||||
|
||||
When it's up, add-ons: ublock origin, privacy badger, noscript, disable search
|
||||
bar prediction
|
||||
|
||||
### Blood-pressure reduction: Clink
|
||||
|
||||
This is a hack on cmd.exe that lets it understand Ctrl-R and fixup unix-style
|
||||
slashes automagically.
|
||||
|
||||
https://github.com/mridgers/clink/releases/download/0.4.9/clink_0.4.9_setup.exe
|
||||
|
||||
If you're usually using *nix, you definitely need this to keep your sanity.
|
||||
|
||||
### Required: cmake
|
||||
|
||||
CMake have a windows installer thing downloadable from here
|
||||
|
||||
|
@ -30,31 +49,133 @@ CMake have a windows installer thing downloadable from here
|
|||
|
||||
after that you can use `cmake` from the terminal OK.
|
||||
|
||||
### Installing git
|
||||
### Required: git
|
||||
|
||||
Visit the canonical git site to download their windows installer thing
|
||||
|
||||
[git](https://git-scm.com/download/win)
|
||||
|
||||
after that `git` from the terminal is working.
|
||||
**Select the install option for "extra unix commands"** so you can get `ls -l`,
|
||||
`cp`, `mv` and suchlike working in cmd.exe... that's awesome, thanks git!
|
||||
|
||||
### Install the free "community" visual studio
|
||||
Afterwards you can just use `git` as normal from cmd.exe as well.
|
||||
|
||||
### Required: Install the "free" "community" visual studio
|
||||
|
||||
You can do this through "windows store" by searching for "visual studio"
|
||||
|
||||
I installed as little as possible, we just want the C "C++" tools.
|
||||
I installed as little as possible, we just want the C "C++" tools... 7GB :-)
|
||||
|
||||
It still wouldn't link without the "mt" helper tool from the
|
||||
huge windows SDK, so you have to install GB of that as well.
|
||||
|
||||
### Building
|
||||
They don't mention it during the install, but after 30 days this "free"
|
||||
"community" edition demands you open a microsoft account or it stops working.
|
||||
In the install they give you the option to add a microsoft account and the
|
||||
alternative is, "not now, maybe later". Compare and contrast to gcc or git or
|
||||
the other FOSS projects.
|
||||
|
||||
Somehow windows cmake seems slightly broken, some of the plugins and
|
||||
examples are conditional on `if (NOT WIN32)`, but it configures them
|
||||
anyway. For this reason (it seems "only", it worked when I commented the
|
||||
cmake entries for the related plugins) `-DLWS_WITH_MINIMAL_EXAMPLES=1`
|
||||
### Required: OpenSSL
|
||||
|
||||
Instead I followed how appveyor builds the stuff in CI... clone libwebsockets then
|
||||
Ugh... I tried using prebuilts but it's unreliable and needs an unfeasible
|
||||
amount of trust. So I recommend bite the bullet and build your own... that's
|
||||
trivial on Linux but of course windows makes everything nasty.
|
||||
|
||||
At least hopefully all the "research" is done and listed out here.
|
||||
|
||||
#### OpenSSL build Prerequisite: install perl binary
|
||||
|
||||
Move the git version of perl out of the way, it won't work for OpenSSL build
|
||||
|
||||
```
|
||||
mv /usr/bin/perl /usr/bin/perl-git
|
||||
```
|
||||
|
||||
For windows, OpenSSL "recommends" ActiveState perl but it doesn't work for me,
|
||||
complaining about stuff needed from cpan and then dying when it was installed.
|
||||
"Strawberry Perl" is installed in `C:\Strawberry` and worked out the box.
|
||||
|
||||
http://strawberryperl.com/download/5.30.2.1/strawberry-perl-5.30.2.1-64bit.msi
|
||||
|
||||
The installer sets up `%PATH%` if you open a new cmd window.
|
||||
|
||||
#### OpenSSL build Prerequisite: NASM
|
||||
|
||||
Go here and click on the latest stable, download the win32 .exe
|
||||
|
||||
https://nasm.us/
|
||||
|
||||
Just install via the defaults. Then add it to the PATH temporarily...
|
||||
|
||||
```
|
||||
$ set PATH=%PATH%;C:\Program Files (x86)\NASM
|
||||
```
|
||||
|
||||
#### OpenSSL build setup: source VC env vars
|
||||
|
||||
These fix up the PATH and include dirs etc necessary for VC build in the cmd
|
||||
window.
|
||||
|
||||
```
|
||||
$ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
|
||||
```
|
||||
|
||||
### OpenSSL build:
|
||||
|
||||
Grab openssl from git... assuming the prerequisites above went well it will
|
||||
just sit there building for 30 minutes or whatever.
|
||||
|
||||
```
|
||||
$ git clone https://github.com/openssl/openssl
|
||||
$ cd openssl
|
||||
$ perl Configure VC-WIN64A
|
||||
$ nmake
|
||||
```
|
||||
|
||||
Afterwards, open an Administrator mode cmd.exe, redo the msvc path and then
|
||||
install the build.
|
||||
|
||||
```
|
||||
$ cd openssl
|
||||
$ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
|
||||
$ nmake install
|
||||
```
|
||||
|
||||
Oh another grindingly slow windows build action. Finally it's in there in
|
||||
`C:\Program Files\OpenSSL`.
|
||||
|
||||
libraries are looking for a cert bundle at "C:\Program Files\Common Files\SSL\cert.pem"...
|
||||
it's not documented or included in the zip file from the above, so...
|
||||
|
||||
#### Installing a cert bundle
|
||||
|
||||
You can get a trusted cert bundle from here
|
||||
|
||||
[drwetter/testssl cert bundle](https://raw.githubusercontent.com/drwetter/testssl.sh/3.1dev/etc/Microsoft.pem)
|
||||
|
||||
Save it into `C:\Program Files\Common Files\SSL\cert.pem` where openssl will be able to see it.
|
||||
|
||||
## Required: pthreads
|
||||
|
||||
It's amazing but after all these years windows doesn't offer pthreads compatibility
|
||||
itself. Just like the many other missing POSIX bits like fork().
|
||||
|
||||
I downloaded the latest (2012) zip release of pthreads-win32 from here
|
||||
|
||||
ftp://sourceware.org/pub/pthreads-win32
|
||||
|
||||
Then I created a dir "C:\Program Files (x86)\pthreads", and copied the `dll`,
|
||||
`include` and `lib` subdirs from the `prebuilt` folder in the zip there.
|
||||
|
||||
The cmake incantation to build against pthreads set up like that is
|
||||
|
||||
```
|
||||
$ cmake .. -DLWS_HAVE_PTHREAD_H=1 -DLWS_EXT_PTHREAD_INCLUDE_DIR="C:\Program Files (x86)\pthreads\include" -DLWS_EXT_PTHREAD_LIBRARIES="C:\Program Files (x86)\pthreads\lib\x64\libpthreadGC2.a" -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
```
|
||||
|
||||
## Building libwebsockets
|
||||
|
||||
We'll clone libwebsockets then use cmake to build via vs tools
|
||||
|
||||
```
|
||||
> git clone https://libwebsockets.org/repo/libwebsockets
|
||||
|
@ -72,23 +193,22 @@ there.
|
|||
> cmake --install . --config DEBUG
|
||||
```
|
||||
|
||||
After that you can run the test apps OK.
|
||||
### Hack the libs into view
|
||||
|
||||
## pthreads
|
||||
|
||||
It's amazing but after all these years windows doesn't offer pthreads compatibility
|
||||
itself. Just like the many other missing POSIX bits like fork().
|
||||
|
||||
I downloaded the latest (2012) zip release of pthreads-win32 from here
|
||||
|
||||
ftp://sourceware.org/pub/pthreads-win32
|
||||
|
||||
Then I created a dir "C:\Program Files (x86)\pthreads", and copied the `dll`,
|
||||
`include` and `lib` subdirs from the `prebuilt` folder in the zip there.
|
||||
|
||||
The cmake incantation to build against pthreads set up like that is
|
||||
The libs we built against aren't visible in the system, I don't know what
|
||||
Real Windows Programmers are supposed to do about that, but I used an Admin cmd
|
||||
prompt to copy them into C:\windows\system32
|
||||
|
||||
```
|
||||
$ cmake .. -DLWS_EXT_PTHREAD_INCLUDE_DIR="C:\Program Files (x86)\pthreads\include" -DLWS_EXT_PTHREAD_LIBRARIES="C:\Program Files (x86)\pthreads\lib\x64\libpthreadGC2.a" -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
$ cp "C:\Program Files (x86)\pthreads\dll\x64\pthreadGC2.dll" "C:\Program Files\OpenSSL\bin\libcrypto-3.dll" "C:\Program Files\OpenSSL\bin\libssl-3.dll" C:\Windows\system32
|
||||
```
|
||||
|
||||
After that you can run the test apps OK, eg
|
||||
|
||||
```
|
||||
$ libwebsockets-test-server.exe -s
|
||||
```
|
||||
|
||||
## Note about using paths with spaces in with cmake
|
||||
|
||||
|
||||
|
|
66
READMEs/README.ctest.md
Normal file
66
READMEs/README.ctest.md
Normal file
|
@ -0,0 +1,66 @@
|
|||
## Using CTest with lws
|
||||
|
||||
### Prerequisites
|
||||
|
||||
You need a recent cmake to have the CTest tests work properly, if you're on an
|
||||
older distro you need to update your cmake. Luckily Kitware provide a repo for
|
||||
common distros. These instructions work for bionic and xenial.
|
||||
|
||||
First remove the old distro cmake and install the pieces needed to get the new repo keys
|
||||
|
||||
```
|
||||
# apt purge --auto-remove cmake
|
||||
# apt install gnupg wget apt-transport-https ca-certificates
|
||||
# wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
|
||||
# apt edit-sources
|
||||
```
|
||||
|
||||
Add the line `deb https://apt.kitware.com/ubuntu/ bionic main` at the end
|
||||
replacing `bionic` with `xenial` as needed, and save (:wq). Then
|
||||
|
||||
```
|
||||
# apt update
|
||||
# apt install cmake
|
||||
```
|
||||
|
||||
## Generating the tests
|
||||
|
||||
The main tests just need `-DLWS_WITH_MINIMAL_EXAMPLES=1`. You can optionally set
|
||||
`-DLWS_CTEST_INTERNET_AVAILABLE=0` to indicate you can't run the tests that need
|
||||
internet connectivity.
|
||||
|
||||
## Running the tests
|
||||
|
||||
CMake puts the test action into a build-host type specific form, for unix type
|
||||
platforms you just run `make test` or `CTEST_OUTPUT_ON_FAILURE=1 make test` to
|
||||
see what happened to any broken tests.
|
||||
|
||||
On windows, it looks like `ctest . -C DEBUG` or RELEASE if that was the build
|
||||
type.
|
||||
|
||||
## Considerations for creating tests
|
||||
|
||||
### Timeout
|
||||
|
||||
The default test timeout is 1500s, for that reason it's good practice to set
|
||||
a more suitable `TIMEOUT` property on every test.
|
||||
|
||||
### Working Directory
|
||||
|
||||
Server-side test apps usually need to be run from their `./minimal-examples/...`
|
||||
directory so they can access their assets like index.html etc.
|
||||
|
||||
However when building with `-DLWS_WITH_MBEDTLS=1` then even client-side apps
|
||||
need to be run from their directory, since they need to get the trusted CA for
|
||||
warmcat.com or libwebsockets.org additionally.
|
||||
|
||||
For that reason it's good practice to set the `WORKING_DIRECTORY` property to
|
||||
the home dir of the example app in all cases.
|
||||
|
||||
### SIGTERM from CTest...
|
||||
|
||||
After a lot of headscratching I realized some tests were failing simply because
|
||||
CTest was firing SIGTERMs at them for whatever reason. I added a commandline
|
||||
option `--ignore-sigterm` in `lws_cmdline_option_handle_builtin()` to allow the
|
||||
test to defeat this, and then it continues and completes fine.
|
||||
|
77
appveyor.yml
77
appveyor.yml
|
@ -1,77 +0,0 @@
|
|||
environment:
|
||||
matrix:
|
||||
- LWS_METHOD: jose
|
||||
CMAKE_ARGS: -DLWS_WITH_JOSE=1
|
||||
|
||||
- LWS_METHOD: x64
|
||||
CMAKE_ARGS: -DCMAKE_GENERATOR_PLATFORM=x64 -DLWS_WITH_HTTP2=1 -DLWS_WITH_PLUGINS=1 -DLIBUV_INCLUDE_DIRS=C:\assets\libuv64\include -DLIBUV_LIBRARIES=C:\assets\libuv64\libuv.lib
|
||||
|
||||
- LWS_METHOD: lwsws
|
||||
CMAKE_ARGS: -DLWS_WITH_LWSWS=1 -DSQLITE3_INCLUDE_DIRS=C:\assets\sqlite3 -DSQLITE3_LIBRARIES=C:\assets\sqlite3\sqlite3.lib -DLIBUV_INCLUDE_DIRS=C:\assets\libuv\include -DLIBUV_LIBRARIES=C:\assets\libuv\libuv.lib
|
||||
|
||||
- LWS_METHOD: default
|
||||
|
||||
- LWS_METHOD: noserver
|
||||
CMAKE_ARGS: -DLWS_WITHOUT_SERVER=ON
|
||||
|
||||
- LWS_METHOD: noclient
|
||||
CMAKE_ARGS: -DLWS_WITHOUT_CLIENT=ON
|
||||
|
||||
- LWS_METHOD: noext
|
||||
CMAKE_ARGS: -DLWS_WITHOUT_EXTENSIONS=ON
|
||||
|
||||
- LWS_METHOD: nossl
|
||||
CMAKE_ARGS: -DLWS_WITH_SSL=OFF
|
||||
|
||||
install:
|
||||
- appveyor DownloadFile https://libwebsockets.org:444/win-libuv.zip
|
||||
- mkdir c:\assets
|
||||
- mkdir c:\assets\libuv
|
||||
- 7z x -oc:\assets\libuv win-libuv.zip
|
||||
- appveyor DownloadFile https://libwebsockets.org:444/win-libuv64.zip
|
||||
- mkdir c:\assets\libuv64
|
||||
- 7z x -oc:\assets\libuv64 win-libuv64.zip
|
||||
- appveyor DownloadFile https://libwebsockets.org:444/nsis-3.0rc1-setup.exe
|
||||
- cmd /c start /wait nsis-3.0rc1-setup.exe /S /D=C:\nsis
|
||||
- appveyor DownloadFile https://libwebsockets.org:444/sqlite-dll-win32-x86-3130000.zip
|
||||
- mkdir c:\assets\sqlite3
|
||||
- 7z x -oc:\assets\sqlite3 sqlite-dll-win32-x86-3130000.zip
|
||||
- SET PATH=C:\Program Files\NSIS\;C:\Program Files (x86)\NSIS\;c:\nsis;%PATH%
|
||||
|
||||
build_script:
|
||||
- md build
|
||||
- cd build
|
||||
- cmake -DCMAKE_BUILD_TYPE=Release %CMAKE_ARGS% ..
|
||||
- cmake --build . --config Release
|
||||
|
||||
after_build:
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
- mkdir staging
|
||||
- mkdir staging\include
|
||||
- cp -r %APPVEYOR_BUILD_FOLDER%\build\bin %APPVEYOR_BUILD_FOLDER%\build\lib staging
|
||||
- if EXIST staging\bin\share mv staging\bin\share staging
|
||||
- if NOT EXIST staging\share\libwebsockets-test-server mkdir staging\share\libwebsockets-test-server
|
||||
- IF EXIST %APPVEYOR_BUILD_FOLDER%\build\libwebsockets-test-server.pem cp %APPVEYOR_BUILD_FOLDER%\build\libwebsockets-test-server.pem staging\share\libwebsockets-test-server
|
||||
- IF EXIST %APPVEYOR_BUILD_FOLDER%\build\libwebsockets-test-server.key.pem cp %APPVEYOR_BUILD_FOLDER%\build\libwebsockets-test-server.key.pem staging\share\libwebsockets-test-server
|
||||
- IF EXIST %APPVEYOR_BUILD_FOLDER%\build\lws_config.h cp %APPVEYOR_BUILD_FOLDER%\build\lws_config.h staging\include
|
||||
- cp %APPVEYOR_BUILD_FOLDER%\include\libwebsockets.h staging\include
|
||||
- cp -r %APPVEYOR_BUILD_FOLDER%\include\libwebsockets staging\include
|
||||
- 7z a build\lws-%LWS_METHOD%-%APPVEYOR_BUILD_ID%.zip %APPVEYOR_BUILD_FOLDER%\staging\*
|
||||
|
||||
artifacts:
|
||||
- path: build\lws-%LWS_METHOD%-%APPVEYOR_BUILD_ID%.zip
|
||||
|
||||
#deploy:
|
||||
#- provider: BinTray
|
||||
# username: lws-team
|
||||
# api_key:
|
||||
# secure: nDpZ7P/wrk98DwJPMC6KpCC23QrVP8f3RxvKzBaqOmb9LiVrg1IyO1cc5vcgShZC
|
||||
# subject: lws-team
|
||||
# repo: libwebsockets
|
||||
# package: windows
|
||||
# publish: true
|
||||
# override: true
|
||||
# explode: false
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
|
@ -144,6 +144,7 @@ __lws_free_wsi(struct lws *wsi)
|
|||
return;
|
||||
|
||||
__lws_reset_wsi(wsi);
|
||||
__lws_wsi_remove_from_sul(wsi);
|
||||
|
||||
if (wsi->context->event_loop_ops->destroy_wsi)
|
||||
wsi->context->event_loop_ops->destroy_wsi(wsi);
|
||||
|
@ -271,7 +272,7 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
|
|||
wsi2 = wsi->child_list;
|
||||
while (wsi2) {
|
||||
wsi1 = wsi2->sibling_list;
|
||||
wsi2->parent = NULL;
|
||||
// wsi2->parent = NULL;
|
||||
/* stop it doing shutdown processing */
|
||||
wsi2->socket_is_permanently_unusable = 1;
|
||||
__lws_close_free_wsi(wsi2, reason,
|
||||
|
@ -306,7 +307,7 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,
|
|||
lws_cgi_remove_and_kill(wsi->parent);
|
||||
|
||||
/* end the binding between us and master */
|
||||
if (wsi->parent->http.cgi)
|
||||
if (wsi->parent->http.cgi && wsi->parent->http.cgi->lsp)
|
||||
wsi->parent->http.cgi->lsp->stdwsi[(int)wsi->lsp_channel] =
|
||||
NULL;
|
||||
}
|
||||
|
@ -454,7 +455,7 @@ just_kill_connection:
|
|||
!wsi->already_did_cce && wsi->protocol) {
|
||||
static const char _reason[] = "closed before established";
|
||||
|
||||
lwsl_notice("%s: closing in unestablished state 0x%x\n",
|
||||
lwsl_debug("%s: closing in unestablished state 0x%x\n",
|
||||
__func__, lwsi_state(wsi));
|
||||
wsi->socket_is_permanently_unusable = 1;
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ lws_callback_ws_proxy(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
|
||||
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
|
||||
case LWS_CALLBACK_CLIENT_CLOSED:
|
||||
lwsl_user("%s: client closed: parent %p\n", __func__, wsi->parent);
|
||||
lwsl_info("%s: client closed: parent %p\n", __func__, wsi->parent);
|
||||
if (wsi->parent)
|
||||
lws_set_timeout(wsi->parent, 1, LWS_TO_KILL_ASYNC);
|
||||
break;
|
||||
|
@ -193,7 +193,7 @@ lws_callback_ws_proxy(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
return 1;
|
||||
|
||||
case LWS_CALLBACK_CLOSED:
|
||||
lwsl_user("%s: closed\n", __func__);
|
||||
lwsl_info("%s: closed\n", __func__);
|
||||
return -1;
|
||||
|
||||
case LWS_CALLBACK_RECEIVE:
|
||||
|
|
|
@ -417,7 +417,7 @@ __remove_wsi_socket_from_fds(struct lws *wsi)
|
|||
lwsl_err("no wsi for fd %d pos %d, "
|
||||
"pt->fds_count=%d\n",
|
||||
(int)pt->fds[m].fd, m, pt->fds_count);
|
||||
assert(0);
|
||||
// assert(0);
|
||||
} else
|
||||
end_wsi->position_in_fds_table = m;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#ifdef LWS_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
|
||||
void
|
||||
lws_ser_wu16be(uint8_t *b, uint16_t u)
|
||||
|
@ -1086,9 +1087,15 @@ lws_cmdline_option(int argc, const char **argv, const char *val)
|
|||
static const char * const builtins[] = {
|
||||
"-d",
|
||||
"--udp-tx-loss",
|
||||
"--udp-rx-loss"
|
||||
"--udp-rx-loss",
|
||||
"--ignore-sigterm"
|
||||
};
|
||||
|
||||
static void
|
||||
lws_sigterm_catch(int sig)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
lws_cmdline_option_handle_builtin(int argc, const char **argv,
|
||||
struct lws_context_creation_info *info)
|
||||
|
@ -1113,6 +1120,9 @@ lws_cmdline_option_handle_builtin(int argc, const char **argv,
|
|||
case 2:
|
||||
info->udp_loss_sim_rx_pc = m;
|
||||
break;
|
||||
case 3:
|
||||
signal(SIGTERM, lws_sigterm_catch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -545,7 +545,8 @@ elops_destroy_context2_uv(struct lws_context *context)
|
|||
static int
|
||||
elops_wsi_logical_close_uv(struct lws *wsi)
|
||||
{
|
||||
if (!lws_socket_is_valid(wsi->desc.sockfd))
|
||||
if (!lws_socket_is_valid(wsi->desc.sockfd) &&
|
||||
wsi->role_ops != &role_ops_raw_file)
|
||||
return 0;
|
||||
|
||||
if (wsi->listener || wsi->event_pipe) {
|
||||
|
@ -656,7 +657,7 @@ elops_io_uv(struct lws *wsi, int flags)
|
|||
}
|
||||
|
||||
if (!w->uv.pwatcher || wsi->told_event_loop_closed) {
|
||||
lwsl_err("%s: no watcher\n", __func__);
|
||||
lwsl_info("%s: no watcher\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ lws_struct_default_lejp_cb(struct lejp_ctx *ctx, char reason)
|
|||
if (map->type == LSMT_SCHEMA) {
|
||||
|
||||
while (n--) {
|
||||
if (strcmp(map->colname, ctx->buf)) {
|
||||
if (strncmp(map->colname, ctx->buf, ctx->npos)) {
|
||||
map++;
|
||||
continue;
|
||||
}
|
||||
|
@ -157,7 +157,9 @@ lws_struct_default_lejp_cb(struct lejp_ctx *ctx, char reason)
|
|||
|
||||
return 0;
|
||||
}
|
||||
lwsl_notice("%s: unknown schema\n", __func__);
|
||||
lwsl_notice("%s: unknown schema %.*s, tried %d\n", __func__,
|
||||
ctx->npos, ctx->buf,
|
||||
(int)args->map_entries_st[ctx->pst_sp]);
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
|
@ -511,7 +511,7 @@ lws_struct_sq3_open(struct lws_context *context, const char *sqlite3_path,
|
|||
SQLITE_OPEN_READWRITE |
|
||||
(create_if_missing ? SQLITE_OPEN_CREATE : 0),
|
||||
NULL) != SQLITE_OK) {
|
||||
lwsl_err("%s: Unable to open db %s: %s\n",
|
||||
lwsl_info("%s: Unable to open db %s: %s\n",
|
||||
__func__, sqlite3_path, sqlite3_errmsg(*pdb));
|
||||
|
||||
return 1;
|
||||
|
@ -520,7 +520,8 @@ lws_struct_sq3_open(struct lws_context *context, const char *sqlite3_path,
|
|||
#if !defined(WIN32)
|
||||
lws_get_effective_uid_gid(context, &uid, &gid);
|
||||
if (uid)
|
||||
chown(sqlite3_path, uid, gid);
|
||||
if (chown(sqlite3_path, uid, gid))
|
||||
lwsl_err("%s: failed to chown %s\n", __func__, sqlite3_path);
|
||||
chmod(sqlite3_path, 0600);
|
||||
|
||||
lwsl_debug("%s: created %s owned by %u:%u mode 0600\n", __func__,
|
||||
|
|
|
@ -319,9 +319,6 @@ lws_threadpool_tsi_context(struct lws_context *context, int tsi)
|
|||
struct lws_threadpool_task **c, *task = NULL;
|
||||
struct lws_threadpool *tp;
|
||||
struct lws *wsi;
|
||||
char some = 0;
|
||||
|
||||
lwsl_notice("%s\n", __func__);
|
||||
|
||||
lws_context_lock(context, __func__);
|
||||
|
||||
|
@ -340,10 +337,10 @@ lws_threadpool_tsi_context(struct lws_context *context, int tsi)
|
|||
|
||||
wsi = task_to_wsi(task);
|
||||
if (!wsi || wsi->tsi != tsi ||
|
||||
!task->wanted_writeable_cb)
|
||||
(!task->wanted_writeable_cb &&
|
||||
task->status != LWS_TP_STATUS_SYNCING))
|
||||
continue;
|
||||
|
||||
some = 1;
|
||||
task->wanted_writeable_cb = 0;
|
||||
lws_memory_barrier();
|
||||
|
||||
|
@ -365,9 +362,9 @@ lws_threadpool_tsi_context(struct lws_context *context, int tsi)
|
|||
wsi = task_to_wsi(task);
|
||||
|
||||
if (wsi && wsi->tsi == tsi &&
|
||||
task->wanted_writeable_cb) {
|
||||
(task->wanted_writeable_cb ||
|
||||
task->status == LWS_TP_STATUS_SYNCING)) {
|
||||
|
||||
some = 1;
|
||||
task->wanted_writeable_cb = 0;
|
||||
lws_memory_barrier();
|
||||
|
||||
|
@ -386,9 +383,6 @@ lws_threadpool_tsi_context(struct lws_context *context, int tsi)
|
|||
tp = tp->tp_list;
|
||||
}
|
||||
|
||||
if (!some)
|
||||
lwsl_notice("%s: unable to find task wanting sync\n", __func__);
|
||||
|
||||
lws_context_unlock(context);
|
||||
|
||||
return 0;
|
||||
|
@ -829,6 +823,7 @@ lws_threadpool_destroy(struct lws_threadpool *tp)
|
|||
|
||||
pthread_mutex_destroy(&tp->lock);
|
||||
|
||||
memset(tp, 0xdd, sizeof(*tp));
|
||||
lws_free(tp);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ delete_from_fd(const struct lws_context *context, int fd)
|
|||
p++;
|
||||
|
||||
if (p == done)
|
||||
lwsl_err("%s: fd %d not found\n", __func__, fd);
|
||||
lwsl_debug("%s: fd %d not found\n", __func__, fd);
|
||||
else
|
||||
*p = NULL;
|
||||
|
||||
|
|
|
@ -110,6 +110,8 @@ lws_spawn_piped_destroy(struct lws_spawn_piped **_lsp)
|
|||
|
||||
lws_sul_schedule(lsp->info.vh->context, lsp->info.tsi, &lsp->sul,
|
||||
NULL, LWS_SET_TIMER_USEC_CANCEL);
|
||||
lws_sul_schedule(lsp->info.vh->context, lsp->info.tsi, &lsp->sul_reap,
|
||||
NULL, LWS_SET_TIMER_USEC_CANCEL);
|
||||
|
||||
for (n = 0; n < 3; n++) {
|
||||
#if 0
|
||||
|
@ -179,7 +181,8 @@ lws_spawn_reap(struct lws_spawn_piped *lsp)
|
|||
*/
|
||||
|
||||
if (!lsp->ungraceful && lsp->pipes_alive) {
|
||||
lwsl_debug("%s: stdwsi alive, not reaping\n", __func__);
|
||||
lwsl_notice("%s: %d stdwsi alive, not reaping\n", __func__,
|
||||
lsp->pipes_alive);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -326,9 +329,16 @@ lws_spawn_piped(const struct lws_spawn_piped_info *i)
|
|||
|
||||
/* create pipes for [stdin|stdout] and [stderr] */
|
||||
|
||||
for (n = 0; n < 3; n++)
|
||||
for (n = 0; n < 3; n++) {
|
||||
if (pipe(lsp->pipe_fds[n]) == -1)
|
||||
goto bail1;
|
||||
lws_plat_apply_FD_CLOEXEC(lsp->pipe_fds[n][n == 0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* At this point, we have 6 pipe fds open on lws side and no wsis
|
||||
* bound to them
|
||||
*/
|
||||
|
||||
/* create wsis for each stdin/out/err fd */
|
||||
|
||||
|
@ -350,14 +360,26 @@ lws_spawn_piped(const struct lws_spawn_piped_info *i)
|
|||
|
||||
/* read side is 0, stdin we want the write side, others read */
|
||||
|
||||
lws_plat_apply_FD_CLOEXEC(lsp->pipe_fds[n][n == 0]);
|
||||
lsp->stdwsi[n]->desc.sockfd = lsp->pipe_fds[n][n == 0];
|
||||
if (fcntl(lsp->pipe_fds[n][n == 0], F_SETFL, O_NONBLOCK) < 0) {
|
||||
lwsl_err("%s: setting NONBLOCK failed\n", __func__);
|
||||
goto bail2;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have bound 3 x pipe fds to wsis, wr side of stdin and rd
|
||||
* side of stdout / stderr... those are marked CLOEXEC so they
|
||||
* won't go through the fork
|
||||
*
|
||||
* rd side of stdin and wr side of stdout / stderr are open but
|
||||
* not bound to anything on lws side.
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Stitch the wsi fd into the poll wait
|
||||
*/
|
||||
|
||||
for (n = 0; n < 3; n++) {
|
||||
if (context->event_loop_ops->sock_accept)
|
||||
if (context->event_loop_ops->sock_accept(lsp->stdwsi[n]))
|
||||
|
@ -384,7 +406,7 @@ lws_spawn_piped(const struct lws_spawn_piped_info *i)
|
|||
lsp->stdwsi[LWS_STDOUT]->desc.sockfd,
|
||||
lsp->stdwsi[LWS_STDERR]->desc.sockfd);
|
||||
|
||||
/* we are ready with the redirection pipes... run the thing */
|
||||
/* we are ready with the redirection pipes... do the (v)fork */
|
||||
#if !defined(LWS_HAVE_VFORK) || !defined(LWS_HAVE_EXECVPE)
|
||||
lsp->child_pid = fork();
|
||||
#else
|
||||
|
@ -407,15 +429,13 @@ lws_spawn_piped(const struct lws_spawn_piped_info *i)
|
|||
if (lsp->child_pid) {
|
||||
|
||||
/*
|
||||
* We are the parent process
|
||||
*
|
||||
* close: stdin:r, stdout:w, stderr:w
|
||||
* hide from other forks: stdin:w, stdout:r, stderr:r
|
||||
* We are the parent process. We can close our copy of the
|
||||
* "other" side of the pipe fds, ie, rd for stdin and wr for
|
||||
* stdout / stderr.
|
||||
*/
|
||||
for (n = 0; n < 3; n++) {
|
||||
/* these guys don't have any wsi footprint */
|
||||
for (n = 0; n < 3; n++)
|
||||
/* these guys didn't have any wsi footprint */
|
||||
close(lsp->pipe_fds[n][n != 0]);
|
||||
}
|
||||
|
||||
lsp->pipes_alive = 3;
|
||||
lsp->created = lws_now_usecs();
|
||||
|
@ -460,25 +480,25 @@ lws_spawn_piped(const struct lws_spawn_piped_info *i)
|
|||
if (chdir(wd))
|
||||
lwsl_notice("%s: Failed to cd to %s\n", __func__, wd);
|
||||
|
||||
/*
|
||||
* Bind the child's stdin / out / err to its side of our pipes
|
||||
*/
|
||||
|
||||
for (m = 0; m < 3; m++) {
|
||||
if (dup2(lsp->pipe_fds[m][m != 0], m) < 0) {
|
||||
lwsl_err("%s: stdin dup2 failed\n", __func__);
|
||||
goto bail3;
|
||||
}
|
||||
/*
|
||||
* If we used fork(), then we can close both sides of the
|
||||
* original pipe now we bound it to fd 0, 1, 2.
|
||||
* CLOEXEC on the lws-side of the pipe fds should have already
|
||||
* dealt with closing those for the child perspective.
|
||||
*
|
||||
* But if we used vfork(), until the exec() we have hijacked
|
||||
* the original process temporarily and we are (ab)using its
|
||||
* identity during this pre-exec() time
|
||||
* Now it has done the dup, the child should close its original
|
||||
* copies of its side of the pipes.
|
||||
*/
|
||||
#if !defined(LWS_HAVE_VFORK) || !defined(LWS_HAVE_EXECVPE)
|
||||
close(lsp->pipe_fds[m][m != 0]);
|
||||
#endif
|
||||
}
|
||||
|
||||
// lwsl_notice("%s: child cd %s, exec %s\n", __func__, wd, i->exec_array[0]);
|
||||
close(lsp->pipe_fds[m][m != 0]);
|
||||
}
|
||||
|
||||
#if !defined(LWS_HAVE_VFORK) || !defined(LWS_HAVE_EXECVPE)
|
||||
#if defined(__linux__)
|
||||
|
|
|
@ -128,6 +128,9 @@ lws_spawn_piped_destroy(struct lws_spawn_piped **_lsp)
|
|||
lws_sul_schedule(lsp->info.vh->context, lsp->info.tsi, &lsp->sul,
|
||||
NULL, LWS_SET_TIMER_USEC_CANCEL);
|
||||
|
||||
lws_sul_schedule(lsp->context, 0, &lsp->sul_reap, NULL,
|
||||
LWS_SET_TIMER_USEC_CANCEL);
|
||||
|
||||
lws_sul_schedule(lsp->context, 0, &lsp->sul_poll, NULL,
|
||||
LWS_SET_TIMER_USEC_CANCEL);
|
||||
|
||||
|
|
|
@ -113,6 +113,15 @@ rops_pt_init_destroy_cgi(struct lws_context *context,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rops_close_role_cgi(struct lws_context_per_thread *pt, struct lws *wsi)
|
||||
{
|
||||
if (wsi->parent && wsi->parent->http.cgi && wsi->parent->http.cgi->lsp)
|
||||
lws_spawn_stdwsi_closed(wsi->parent->http.cgi->lsp, wsi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const struct lws_role_ops role_ops_cgi = {
|
||||
/* role name */ "cgi",
|
||||
|
@ -131,7 +140,7 @@ const struct lws_role_ops role_ops_cgi = {
|
|||
/* encapsulation_parent */ NULL,
|
||||
/* alpn_negotiated */ NULL,
|
||||
/* close_via_role_protocol */ NULL,
|
||||
/* close_role */ NULL,
|
||||
/* close_role */ rops_close_role_cgi,
|
||||
/* close_kill_connection */ NULL,
|
||||
/* destroy_role */ rops_destroy_role_cgi,
|
||||
/* adoption_bind */ NULL,
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
int
|
||||
lws_client_create_tls(struct lws *wsi, const char **pcce, int do_c1)
|
||||
{
|
||||
int n;
|
||||
|
||||
/* we can retry this... just cook the SSL BIO the first time */
|
||||
|
||||
if (wsi->tls.use_ssl & LCCSCF_USE_SSL) {
|
||||
int n;
|
||||
|
||||
if (!wsi->tls.ssl) {
|
||||
if (lws_ssl_client_bio_create(wsi) < 0) {
|
||||
|
@ -50,12 +50,13 @@ lws_client_create_tls(struct lws *wsi, const char **pcce, int do_c1)
|
|||
if (!do_c1)
|
||||
return 0;
|
||||
|
||||
n = lws_ssl_client_connect1(wsi);
|
||||
n = lws_ssl_client_connect1(wsi, (char *)wsi->context->pt[(int)wsi->tsi].serv_buf,
|
||||
wsi->context->pt_serv_buf_size);
|
||||
lwsl_debug("%s: lws_ssl_client_connect1: %d\n", __func__, n);
|
||||
if (!n)
|
||||
return CCTLS_RETURN_RETRY; /* caller should return 0 */
|
||||
if (n < 0) {
|
||||
*pcce = "lws_ssl_client_connect1 failed";
|
||||
*pcce = (const char *)wsi->context->pt[(int)wsi->tsi].serv_buf;
|
||||
return CCTLS_RETURN_ERROR;
|
||||
}
|
||||
} else
|
||||
|
@ -485,6 +486,8 @@ bail3:
|
|||
__func__, wsi, lwsi_state(wsi));
|
||||
if (cce)
|
||||
lwsl_info("reason: %s\n", cce);
|
||||
else
|
||||
cce = "unknown";
|
||||
lws_inform_client_conn_fail(wsi, (void *)cce, strlen(cce));
|
||||
|
||||
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "cbail3");
|
||||
|
|
|
@ -131,7 +131,7 @@ lws_ws_handshake_client(struct lws *wsi, unsigned char **buf, size_t len)
|
|||
*/
|
||||
|
||||
if (lws_ws_client_rx_sm(wsi, *(*buf)++)) {
|
||||
lwsl_notice("%s: client_rx_sm exited, DROPPING %d\n",
|
||||
lwsl_info("%s: client_rx_sm exited, DROPPING %d\n",
|
||||
__func__, (int)len);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ int ERR_get_error(void)
|
|||
}
|
||||
|
||||
enum lws_ssl_capable_status
|
||||
lws_tls_client_connect(struct lws *wsi)
|
||||
lws_tls_client_connect(struct lws *wsi, char *errbuf, int elen)
|
||||
{
|
||||
int m, n = SSL_connect(wsi->tls.ssl);
|
||||
const unsigned char *prot;
|
||||
|
@ -191,6 +191,8 @@ lws_tls_client_connect(struct lws *wsi)
|
|||
if (!n) /* we don't know what he wants, but he says to retry */
|
||||
return LWS_SSL_CAPABLE_MORE_SERVICE;
|
||||
|
||||
lws_snprintf(errbuf, elen, "mbedtls connect %d %d %d", n, m, errno);
|
||||
|
||||
return LWS_SSL_CAPABLE_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ lws_tls_server_accept(struct lws *wsi)
|
|||
}
|
||||
|
||||
m = SSL_get_error(wsi->tls.ssl, n);
|
||||
lwsl_debug("%s: %p: accept SSL_get_error %d errno %d\n", __func__,
|
||||
lwsl_notice("%s: %p: accept SSL_get_error %d errno %d\n", __func__,
|
||||
wsi, m, errno);
|
||||
|
||||
// mbedtls wrapper only
|
||||
|
|
|
@ -376,7 +376,7 @@ no_client_cert:
|
|||
}
|
||||
|
||||
enum lws_ssl_capable_status
|
||||
lws_tls_client_connect(struct lws *wsi)
|
||||
lws_tls_client_connect(struct lws *wsi, char *errbuf, int elen)
|
||||
{
|
||||
#if defined(LWS_HAVE_SSL_set_alpn_protos) && \
|
||||
defined(LWS_HAVE_SSL_get0_alpn_selected)
|
||||
|
@ -384,17 +384,13 @@ lws_tls_client_connect(struct lws *wsi)
|
|||
char a[32];
|
||||
unsigned int len;
|
||||
#endif
|
||||
int m, n;
|
||||
#if defined(WIN32) || (_LWS_ENABLED_LOGS & LLL_INFO)
|
||||
int en;
|
||||
#endif
|
||||
int m, n, en;
|
||||
|
||||
errno = 0;
|
||||
ERR_clear_error();
|
||||
n = SSL_connect(wsi->tls.ssl);
|
||||
#if defined(WIN32) || (_LWS_ENABLED_LOGS & LLL_INFO)
|
||||
en = errno;
|
||||
#endif
|
||||
|
||||
m = lws_ssl_get_error(wsi, n);
|
||||
|
||||
if (m == SSL_ERROR_SYSCALL
|
||||
|
@ -405,11 +401,15 @@ lws_tls_client_connect(struct lws *wsi)
|
|||
#if defined(WIN32) || (_LWS_ENABLED_LOGS & LLL_INFO)
|
||||
lwsl_info("%s: n %d, m %d, errno %d\n", __func__, n, m, en);
|
||||
#endif
|
||||
lws_snprintf(errbuf, elen, "connect SYSCALL %d", en);
|
||||
return LWS_SSL_CAPABLE_ERROR;
|
||||
}
|
||||
|
||||
if (m == SSL_ERROR_SSL)
|
||||
if (m == SSL_ERROR_SSL) {
|
||||
n = lws_snprintf(errbuf, elen, "connect SSL err %d: ", m);
|
||||
ERR_error_string_n(m, errbuf + n, elen - n);
|
||||
return LWS_SSL_CAPABLE_ERROR;
|
||||
}
|
||||
|
||||
if (m == SSL_ERROR_WANT_READ || SSL_want_read(wsi->tls.ssl))
|
||||
return LWS_SSL_CAPABLE_MORE_SERVICE_READ;
|
||||
|
@ -437,6 +437,8 @@ lws_tls_client_connect(struct lws *wsi)
|
|||
if (!n) /* we don't know what he wants, but he says to retry */
|
||||
return LWS_SSL_CAPABLE_MORE_SERVICE;
|
||||
|
||||
lws_snprintf(errbuf, elen, "connect unk %d", m);
|
||||
|
||||
return LWS_SSL_CAPABLE_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ int lws_ssl_get_error(struct lws *wsi, int n)
|
|||
lwsl_debug("%s: %p %d -> %d (errno %d)\n", __func__, wsi->tls.ssl, n, m,
|
||||
errno);
|
||||
|
||||
assert (errno != 9);
|
||||
// assert (errno != 9);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ lws_ssl_remove_wsi_from_buffered_list(struct lws *wsi);
|
|||
LWS_EXTERN int
|
||||
lws_ssl_client_bio_create(struct lws *wsi);
|
||||
LWS_EXTERN int
|
||||
lws_ssl_client_connect1(struct lws *wsi);
|
||||
lws_ssl_client_connect1(struct lws *wsi, char *errbuf, int len);
|
||||
LWS_EXTERN int
|
||||
lws_ssl_client_connect2(struct lws *wsi, char *errbuf, int len);
|
||||
LWS_EXTERN int
|
||||
|
@ -158,7 +158,7 @@ LWS_EXTERN enum lws_ssl_capable_status
|
|||
__lws_tls_shutdown(struct lws *wsi);
|
||||
|
||||
LWS_EXTERN enum lws_ssl_capable_status
|
||||
lws_tls_client_connect(struct lws *wsi);
|
||||
lws_tls_client_connect(struct lws *wsi, char *errbuf, int len);
|
||||
LWS_EXTERN int
|
||||
lws_tls_client_confirm_peer_cert(struct lws *wsi, char *ebuf, int ebuf_len);
|
||||
LWS_EXTERN int
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include "private-lib-core.h"
|
||||
|
||||
int
|
||||
lws_ssl_client_connect1(struct lws *wsi)
|
||||
lws_ssl_client_connect1(struct lws *wsi, char *errbuf, int len)
|
||||
{
|
||||
int n;
|
||||
|
||||
n = lws_tls_client_connect(wsi);
|
||||
n = lws_tls_client_connect(wsi, errbuf, len);
|
||||
switch (n) {
|
||||
case LWS_SSL_CAPABLE_ERROR:
|
||||
return -1;
|
||||
|
@ -53,12 +53,12 @@ lws_ssl_client_connect2(struct lws *wsi, char *errbuf, int len)
|
|||
int n;
|
||||
|
||||
if (lwsi_state(wsi) == LRS_WAITING_SSL) {
|
||||
n = lws_tls_client_connect(wsi);
|
||||
n = lws_tls_client_connect(wsi, errbuf, len);
|
||||
lwsl_debug("%s: SSL_connect says %d\n", __func__, n);
|
||||
|
||||
switch (n) {
|
||||
case LWS_SSL_CAPABLE_ERROR:
|
||||
lws_snprintf(errbuf, len, "client connect failed");
|
||||
// lws_snprintf(errbuf, len, "client connect failed");
|
||||
return -1;
|
||||
case LWS_SSL_CAPABLE_DONE:
|
||||
break; /* connected */
|
||||
|
|
|
@ -69,6 +69,11 @@ require_lws_config(LWS_WITH_SYS_ASYNC_DNS 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
add_test(NAME api-test-async-dns COMMAND lws-api-test-async-dns)
|
||||
set_tests_properties(api-test-async-dns
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/api-tests/api-test-async-dns
|
||||
TIMEOUT 60)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 apiselftest
|
||||
exit $FAILS
|
|
@ -1,58 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=4
|
||||
|
||||
FAILS=0
|
||||
|
||||
#
|
||||
# let's make an index with just Dorian first
|
||||
#
|
||||
dotest $1 $2 apitest -c -i /tmp/lws-fts-dorian.index \
|
||||
"../minimal-examples/api-tests/api-test-fts/the-picture-of-dorian-gray.txt"
|
||||
|
||||
# and let's hear about autocompletes for "b"
|
||||
|
||||
dotest $1 $2 apitest -i /tmp/lws-fts-dorian.index b
|
||||
cat $2/api-test-fts/apitest.log | cut -d' ' -f5- > /tmp/fts1
|
||||
diff -urN /tmp/fts1 "../minimal-examples/api-tests/api-test-fts/canned-1.txt"
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Test 1 failed"
|
||||
FAILS=$(( $FAILS + 1 ))
|
||||
fi
|
||||
|
||||
#
|
||||
# let's make an index with Dorian + Les Mis in French (ie, UTF-8) as well
|
||||
#
|
||||
dotest $1 $2 apitest -c -i /tmp/lws-fts-both.index \
|
||||
"../minimal-examples/api-tests/api-test-fts/the-picture-of-dorian-gray.txt" \
|
||||
"../minimal-examples/api-tests/api-test-fts/les-mis-utf8.txt"
|
||||
|
||||
# and let's hear about "help", which appears in both
|
||||
|
||||
dotest $1 $2 apitest -i /tmp/lws-fts-both.index -f -l help
|
||||
cat $2/api-test-fts/apitest.log | cut -d' ' -f5- > /tmp/fts2
|
||||
diff -urN /tmp/fts2 "../minimal-examples/api-tests/api-test-fts/canned-2.txt"
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Test 1 failed"
|
||||
FAILS=$(( $FAILS + 1 ))
|
||||
fi
|
||||
|
||||
exit $FAILS
|
|
@ -70,6 +70,7 @@ require_lws_config(LWS_WITH_JOSE 1 requirements)
|
|||
if (requirements)
|
||||
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
add_test(NAME api-test-gencrypto COMMAND lws-api-test-gencrypto)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 apiselftest
|
||||
exit $FAILS
|
|
@ -69,6 +69,10 @@ if (requirements)
|
|||
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
if (NOT (LWS_WITH_MBEDTLS AND NOT LWS_HAVE_mbedtls_internal_aes_encrypt))
|
||||
add_test(NAME api-test-jose COMMAND lws-api-test-jose)
|
||||
endif()
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
add_dependencies(${SAMP} websockets_shared)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 apiselftest
|
||||
exit $FAILS
|
|
@ -69,6 +69,7 @@ require_lws_config(LWS_WITH_LWS_DSH 1 requirements)
|
|||
if (requirements)
|
||||
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
add_test(NAME api-test-lws_dsh COMMAND lws-api-test-lws_dsh)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 apiselftest
|
||||
exit $FAILS
|
|
@ -68,6 +68,7 @@ require_lws_config(LWS_WITH_STRUCT_JSON 1 requirements)
|
|||
if (requirements)
|
||||
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
add_test(NAME api-test-lws_struct-json COMMAND lws-api-test-lws_struct-json)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -296,6 +296,35 @@ static const lws_struct_map_t lsm_schema_map[] = {
|
|||
lsm_other, "com-warmcat-sai-other"),
|
||||
};
|
||||
|
||||
typedef struct sai_cancel {
|
||||
char task_uuid[65];
|
||||
} sai_cancel_t;
|
||||
|
||||
const lws_struct_map_t lsm_task_cancel[] = {
|
||||
LSM_CARRAY (sai_cancel_t, task_uuid, "uuid"),
|
||||
};
|
||||
|
||||
static const lws_struct_map_t t2_map[] = {
|
||||
LSM_SCHEMA (sai_cancel_t, NULL, lsm_task_cancel,
|
||||
"com.warmcat.sai.taskinfo"),
|
||||
LSM_SCHEMA (sai_cancel_t, NULL, lsm_task_cancel,
|
||||
"com.warmcat.sai.eventinfo"),
|
||||
LSM_SCHEMA (sai_cancel_t, NULL, lsm_task_cancel,
|
||||
/* shares struct */ "com.warmcat.sai.taskreset"),
|
||||
LSM_SCHEMA (sai_cancel_t, NULL, lsm_task_cancel,
|
||||
/* shares struct */ "com.warmcat.sai.eventreset"),
|
||||
LSM_SCHEMA (sai_cancel_t, NULL, lsm_task_cancel,
|
||||
/* shares struct */ "com.warmcat.sai.eventdelete"),
|
||||
LSM_SCHEMA (sai_cancel_t, NULL, lsm_task_cancel,
|
||||
"com.warmcat.sai.taskcan"),
|
||||
};
|
||||
|
||||
static const char *t2 =
|
||||
"{\"schema\":\"com.warmcat.sai.taskcan\","
|
||||
"\"uuid\": \"071ab46ab4296e5de674c628fec17c55088254679f7714ad991f8c4873dca\"}\x01\x02\xff\xff\xff\xff";
|
||||
|
||||
|
||||
|
||||
static int
|
||||
show_target(struct lws_dll2 *d, void *user)
|
||||
{
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 apiselftest
|
||||
exit $FAILS
|
|
@ -63,11 +63,12 @@ MACRO(require_lws_config reqconfig _val result)
|
|||
ENDMACRO()
|
||||
|
||||
set(requirements 1)
|
||||
require_lws_config(LWS_WITH_STRUCT_SQLITE 1 requirements)
|
||||
require_lws_config(LWS_WITH_STRUCT_SQLITE3 1 requirements)
|
||||
|
||||
if (requirements)
|
||||
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
add_test(NAME api-test-lws_struct_sqlite COMMAND lws-api-test-lws_struct-sqlite)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared sqlite3)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 apiselftest
|
||||
exit $FAILS
|
|
@ -62,9 +62,8 @@ MACRO(require_lws_config reqconfig _val result)
|
|||
endif()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
add_test(NAME api-test-lws_tokenize COMMAND lws-api-test-lws_tokenize)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 apiselftest
|
||||
exit $FAILS
|
|
@ -62,9 +62,8 @@ MACRO(require_lws_config reqconfig _val result)
|
|||
endif()
|
||||
ENDMACRO()
|
||||
|
||||
|
||||
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
add_test(NAME api-test-lwsac COMMAND lws-api-test-lwsac)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 apiselftest
|
||||
exit $FAILS
|
|
@ -6,42 +6,6 @@ include(CheckLibraryExists)
|
|||
set(SAMP lws-minimal-dbus-client)
|
||||
set(SRCS minimal-dbus-client.c)
|
||||
|
||||
if (NOT LWS_WITH_MINIMAL_EXAMPLES)
|
||||
CHECK_LIBRARY_EXISTS(dbus-1 dbus_connection_set_watch_functions "" LWS_HAVE_LIBDBUS)
|
||||
if (NOT LWS_HAVE_LIBDBUS)
|
||||
message(FATAL_ERROR "Install dbus-devel, or libdbus-1-dev etc")
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_LIB)
|
||||
set(LWS_DBUS_LIB "dbus-1")
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE1)
|
||||
# look in fedora and debian / ubuntu place
|
||||
if (EXISTS "/usr/include/dbus-1.0")
|
||||
set(LWS_DBUS_INCLUDE1 "/usr/include/dbus-1.0")
|
||||
else()
|
||||
message(FATAL_ERROR "Set LWS_DBUS_INCLUDE1 to /usr/include/dbus-1.0 or wherever the main dbus includes are")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE2)
|
||||
# look in fedora... debian / ubuntu has the ARCH in the path...
|
||||
if (EXISTS "/usr/lib64/dbus-1.0/include")
|
||||
set(LWS_DBUS_INCLUDE2 "/usr/lib64/dbus-1.0/include")
|
||||
else()
|
||||
message(FATAL_ERROR "Set LWS_DBUS_INCLUDE2 to /usr/lib/ARCH-linux-gnu/dbus-1.0/include or wherever dbus-arch-deps.h is on your system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${LWS_DBUS_INCLUDE1};${LWS_DBUS_INCLUDE2})
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE1 OR NOT LWS_DBUS_INCLUDE2)
|
||||
message(FATAL_ERROR "To build with libdbus, LWS_DBUS_INCLUDE1/2 must be given. See lib/roles/dbus/README.md")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# If we are being built as part of lws, confirm current build config supports
|
||||
# reqconfig, else skip building ourselves.
|
||||
#
|
||||
|
@ -107,10 +71,15 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
|
||||
if (NOT LWS_PLAT_FREERTOS)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_DBUS1 dbus-1 QUIET)
|
||||
list(APPEND LWS_DBUS_INCLUDE1 ${PC_DBUS1_INCLUDE_DIRS})
|
||||
list(APPEND LWS_DBUS_LIB "${PC_DBUS1_LIBRARIES};dl")
|
||||
endif()
|
||||
|
||||
include_directories("${LWS_DBUS_INCLUDE1}")
|
||||
include_directories("${LWS_DBUS_INCLUDE2}")
|
||||
list(APPEND LIB_LIST dbus-1)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -6,42 +6,6 @@ include(CheckLibraryExists)
|
|||
set(SAMP lws-minimal-dbus-ws-proxy-testclient)
|
||||
set(SRCS minimal-dbus-ws-proxy-testclient.c)
|
||||
|
||||
if (NOT LWS_WITH_MINIMAL_EXAMPLES)
|
||||
CHECK_LIBRARY_EXISTS(dbus-1 dbus_connection_set_watch_functions "" LWS_HAVE_LIBDBUS)
|
||||
if (NOT LWS_HAVE_LIBDBUS)
|
||||
message(FATAL_ERROR "Install dbus-devel, or libdbus-1-dev etc")
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_LIB)
|
||||
set(LWS_DBUS_LIB "dbus-1")
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE1)
|
||||
# look in fedora and debian / ubuntu place
|
||||
if (EXISTS "/usr/include/dbus-1.0")
|
||||
set(LWS_DBUS_INCLUDE1 "/usr/include/dbus-1.0")
|
||||
else()
|
||||
message(FATAL_ERROR "Set LWS_DBUS_INCLUDE1 to /usr/include/dbus-1.0 or wherever the main dbus includes are")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE2)
|
||||
# look in fedora... debian / ubuntu has the ARCH in the path...
|
||||
if (EXISTS "/usr/lib64/dbus-1.0/include")
|
||||
set(LWS_DBUS_INCLUDE2 "/usr/lib64/dbus-1.0/include")
|
||||
else()
|
||||
message(FATAL_ERROR "Set LWS_DBUS_INCLUDE2 to /usr/lib/ARCH-linux-gnu/dbus-1.0/include or wherever dbus-arch-deps.h is on your system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${LWS_DBUS_INCLUDE1};${LWS_DBUS_INCLUDE2})
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE1 OR NOT LWS_DBUS_INCLUDE2)
|
||||
message(FATAL_ERROR "To build with libdbus, LWS_DBUS_INCLUDE1/2 must be given. See lib/roles/dbus/README.md")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# If we are being built as part of lws, confirm current build config supports
|
||||
# reqconfig, else skip building ourselves.
|
||||
#
|
||||
|
@ -107,10 +71,15 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
|
||||
if (NOT LWS_PLAT_FREERTOS)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_DBUS1 dbus-1 QUIET)
|
||||
list(APPEND LWS_DBUS_INCLUDE1 ${PC_DBUS1_INCLUDE_DIRS})
|
||||
list(APPEND LWS_DBUS_LIB "${PC_DBUS1_LIBRARIES};dl")
|
||||
endif()
|
||||
|
||||
include_directories("${LWS_DBUS_INCLUDE1}")
|
||||
include_directories("${LWS_DBUS_INCLUDE2}")
|
||||
list(APPEND LIB_LIST dbus-1)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -6,42 +6,6 @@ include(CheckLibraryExists)
|
|||
set(SAMP lws-minimal-dbus-server)
|
||||
set(SRCS main.c)
|
||||
|
||||
if (NOT LWS_WITH_MINIMAL_EXAMPLES)
|
||||
CHECK_LIBRARY_EXISTS(dbus-1 dbus_connection_set_watch_functions "" LWS_HAVE_LIBDBUS)
|
||||
if (NOT LWS_HAVE_LIBDBUS)
|
||||
message(FATAL_ERROR "Install dbus-devel, or libdbus-1-dev etc")
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_LIB)
|
||||
set(LWS_DBUS_LIB "dbus-1")
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE1)
|
||||
# look in fedora and debian / ubuntu place
|
||||
if (EXISTS "/usr/include/dbus-1.0")
|
||||
set(LWS_DBUS_INCLUDE1 "/usr/include/dbus-1.0")
|
||||
else()
|
||||
message(FATAL_ERROR "Set LWS_DBUS_INCLUDE1 to /usr/include/dbus-1.0 or wherever the main dbus includes are")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE2)
|
||||
# look in fedora... debian / ubuntu has the ARCH in the path...
|
||||
if (EXISTS "/usr/lib64/dbus-1.0/include")
|
||||
set(LWS_DBUS_INCLUDE2 "/usr/lib64/dbus-1.0/include")
|
||||
else()
|
||||
message(FATAL_ERROR "Set LWS_DBUS_INCLUDE2 to /usr/lib/ARCH-linux-gnu/dbus-1.0/include or wherever dbus-arch-deps.h is on your system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${LWS_DBUS_INCLUDE1};${LWS_DBUS_INCLUDE2})
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE1 OR NOT LWS_DBUS_INCLUDE2)
|
||||
message(FATAL_ERROR "To build with libdbus, LWS_DBUS_INCLUDE1/2 must be given. See lib/roles/dbus/README.md")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# If we are being built as part of lws, confirm current build config supports
|
||||
# reqconfig, else skip building ourselves.
|
||||
#
|
||||
|
@ -107,10 +71,15 @@ require_lws_config(LWS_WITH_SERVER 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
|
||||
if (NOT LWS_PLAT_FREERTOS)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_DBUS1 dbus-1 QUIET)
|
||||
list(APPEND LWS_DBUS_INCLUDE1 ${PC_DBUS1_INCLUDE_DIRS})
|
||||
list(APPEND LWS_DBUS_LIB "${PC_DBUS1_LIBRARIES};dl")
|
||||
endif()
|
||||
|
||||
include_directories("${LWS_DBUS_INCLUDE1}")
|
||||
include_directories("${LWS_DBUS_INCLUDE2}")
|
||||
list(APPEND LIB_LIST dbus-1)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -6,42 +6,6 @@ include(CheckLibraryExists)
|
|||
set(SAMP lws-minimal-dbus-ws-proxy)
|
||||
set(SRCS main.c)
|
||||
|
||||
if (NOT LWS_WITH_MINIMAL_EXAMPLES)
|
||||
CHECK_LIBRARY_EXISTS(dbus-1 dbus_connection_set_watch_functions "" LWS_HAVE_LIBDBUS)
|
||||
if (NOT LWS_HAVE_LIBDBUS)
|
||||
message(FATAL_ERROR "Install dbus-devel, or libdbus-1-dev etc")
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_LIB)
|
||||
set(LWS_DBUS_LIB "dbus-1")
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE1)
|
||||
# look in fedora and debian / ubuntu place
|
||||
if (EXISTS "/usr/include/dbus-1.0")
|
||||
set(LWS_DBUS_INCLUDE1 "/usr/include/dbus-1.0")
|
||||
else()
|
||||
message(FATAL_ERROR "Set LWS_DBUS_INCLUDE1 to /usr/include/dbus-1.0 or wherever the main dbus includes are")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE2)
|
||||
# look in fedora... debian / ubuntu has the ARCH in the path...
|
||||
if (EXISTS "/usr/lib64/dbus-1.0/include")
|
||||
set(LWS_DBUS_INCLUDE2 "/usr/lib64/dbus-1.0/include")
|
||||
else()
|
||||
message(FATAL_ERROR "Set LWS_DBUS_INCLUDE2 to /usr/lib/ARCH-linux-gnu/dbus-1.0/include or wherever dbus-arch-deps.h is on your system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${LWS_DBUS_INCLUDE1};${LWS_DBUS_INCLUDE2})
|
||||
|
||||
if (NOT LWS_DBUS_INCLUDE1 OR NOT LWS_DBUS_INCLUDE2)
|
||||
message(FATAL_ERROR "To build with libdbus, LWS_DBUS_INCLUDE1/2 must be given. See lib/roles/dbus/README.md")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# If we are being built as part of lws, confirm current build config supports
|
||||
# reqconfig, else skip building ourselves.
|
||||
#
|
||||
|
@ -110,9 +74,14 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
if (NOT LWS_PLAT_FREERTOS)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_DBUS1 dbus-1 QUIET)
|
||||
list(APPEND LWS_DBUS_INCLUDE1 ${PC_DBUS1_INCLUDE_DIRS})
|
||||
list(APPEND LWS_DBUS_LIB "${PC_DBUS1_LIBRARIES};dl")
|
||||
endif()
|
||||
|
||||
include_directories("${LWS_DBUS_INCLUDE1}")
|
||||
include_directories("${LWS_DBUS_INCLUDE2}")
|
||||
list(APPEND LIB_LIST dbus-1)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -70,6 +70,15 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
if (LWS_CTEST_INTERNET_AVAILABLE)
|
||||
add_test(NAME http-client-h2-rxflow-warmcat COMMAND lws-minimal-http-client-h2-rxflow --ignore-sigterm)
|
||||
add_test(NAME http-client-h2-rxflow-warmcat-h1 COMMAND lws-minimal-http-client-h2-rxflow --ignore-sigterm --h1)
|
||||
set_tests_properties(http-client-h2-rxflow-warmcat
|
||||
http-client-h2-rxflow-warmcat-h1
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/http-client/minimal-http-client-h2-rxflow
|
||||
TIMEOUT 30)
|
||||
endif()
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=4
|
||||
|
||||
dotest $1 $2 warmcat
|
||||
dotest $1 $2 warmcat-h1 --h1
|
||||
|
||||
spawn "" $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost -l
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-h1 -l --h1
|
||||
|
||||
kill $SPID 2>/dev/null
|
||||
wait $SPID 2>/dev/null
|
||||
exit $FAILS
|
|
@ -70,6 +70,17 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
if (LWS_CTEST_INTERNET_AVAILABLE)
|
||||
add_test(NAME http-client-hugeurl-warmcat COMMAND lws-minimal-http-client-hugeurl --ignore-sigterm)
|
||||
add_test(NAME http-client-hugeurl-warmcat-h1 COMMAND lws-minimal-http-client-hugeurl --ignore-sigterm --h1)
|
||||
set_tests_properties(http-client-hugeurl-warmcat
|
||||
http-client-hugeurl-warmcat-h1
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/http-client/minimal-http-client-hugeurl
|
||||
TIMEOUT 20)
|
||||
|
||||
endif()
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
add_dependencies(${SAMP} websockets_shared)
|
||||
|
|
|
@ -149,23 +149,15 @@ int main(int argc, const char **argv)
|
|||
struct lws_context_creation_info info;
|
||||
struct lws_client_connect_info i;
|
||||
struct lws_context *context;
|
||||
const char *p;
|
||||
int n = 0, logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE
|
||||
/* for LLL_ verbosity above NOTICE to be built into lws,
|
||||
* lws must have been configured and built with
|
||||
* -DCMAKE_BUILD_TYPE=DEBUG instead of =RELEASE */
|
||||
/* | LLL_INFO */ /* | LLL_PARSER */ /* | LLL_HEADER */
|
||||
/* | LLL_EXT */ /* | LLL_CLIENT */ /* | LLL_LATENCY */
|
||||
/* | LLL_DEBUG */;
|
||||
|
||||
if ((p = lws_cmdline_option(argc, argv, "-d")))
|
||||
logs = atoi(p);
|
||||
int n = 0;
|
||||
|
||||
signal(SIGINT, sigint_handler);
|
||||
lws_set_log_level(logs, NULL);
|
||||
lwsl_user("LWS minimal http client hugeurl [-d <verbosity>] [-l] [--h1]\n");
|
||||
|
||||
memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */
|
||||
lws_cmdline_option_handle_builtin(argc, argv, &info);
|
||||
|
||||
lwsl_user("LWS minimal http client hugeurl [-d <verbosity>] [-l] [--h1]\n");
|
||||
|
||||
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
|
||||
info.port = CONTEXT_PORT_NO_LISTEN; /* we do not run any server */
|
||||
info.protocols = protocols;
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=6
|
||||
|
||||
dotest $1 $2 warmcat
|
||||
dotest $1 $2 warmcat-h1 --h1
|
||||
|
||||
spawn "" $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost -l
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-h1 -l --h1
|
||||
kill $SPID 2>/dev/null
|
||||
wait $SPID 2>/dev/null
|
||||
|
||||
|
||||
if [ -z "$TRAVIS_OS_NAME" ] ; then
|
||||
SPID=""
|
||||
spawn "" $5/http-server/minimal-http-server-eventlib $1/lws-minimal-http-server-eventlib --uv -s
|
||||
dotest $1 $2 localhost-suv -l
|
||||
spawn $SPID $5/http-server/minimal-http-server-eventlib $1/lws-minimal-http-server-eventlib --uv -s
|
||||
dotest $1 $2 localhost-suv-h1 -l --h1
|
||||
|
||||
kill $SPID 2>/dev/null
|
||||
wait $SPID 2>/dev/null
|
||||
fi
|
||||
|
||||
exit $FAILS
|
||||
|
||||
|
|
@ -70,6 +70,154 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
#
|
||||
# instantiate the server per sai builder instance, they are running in the same
|
||||
# machine context in parallel so they can tread on each other otherwise
|
||||
#
|
||||
set(PORT_HCM_SRV "7670")
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "0")
|
||||
set(PORT_HCM_SRV 7671)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "1")
|
||||
set(PORT_HCM_SRV 7672)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "2")
|
||||
set(PORT_HCM_SRV 7673)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "3")
|
||||
set(PORT_HCM_SRV 7674)
|
||||
endif()
|
||||
|
||||
|
||||
# hack
|
||||
if (NOT WIN32 AND LWS_WITH_SERVER)
|
||||
|
||||
#
|
||||
# Tests against built server running locally (needs daemonization...)
|
||||
#
|
||||
|
||||
if (WIN32)
|
||||
add_test(NAME st_hcm_srv COMMAND cmd.exe /c start /b $<TARGET_FILE:lws-minimal-http-server-tls> --port ${PORT_HCM_SRV})
|
||||
add_test(NAME ki_hcm_srv COMMAND taskkill /F /IM $<TARGET_FILE_NAME:lws-minimal-http-server-tls> /T)
|
||||
add_test(NAME st_hcmp_srv COMMAND cmd.exe /c start /b $<TARGET_FILE:test-server> -s --port 1${PORT_HCM_SRV})
|
||||
add_test(NAME ki_hcmp_srv COMMAND taskkill /F /IM $<TARGET_FILE_NAME:test-server> /T)
|
||||
else()
|
||||
add_test(NAME st_hcm_srv COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background.sh
|
||||
hcm_srv $<TARGET_FILE:lws-minimal-http-server-tls>
|
||||
--port ${PORT_HCM_SRV})
|
||||
add_test(NAME ki_hcm_srv COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background-kill.sh
|
||||
hcm_srv $<TARGET_FILE_NAME:lws-minimal-http-server-tls>
|
||||
--port ${PORT_HCM_SRV})
|
||||
add_test(NAME st_hcmp_srv COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background.sh
|
||||
hcmp_srv $<TARGET_FILE:test-server> -s
|
||||
-r ${CMAKE_SOURCE_DIR}/destdir/usr/local/share/libwebsockets-test-server/
|
||||
--port 1${PORT_HCM_SRV})
|
||||
add_test(NAME ki_hcmp_srv COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background-kill.sh
|
||||
hcmp_srv $<TARGET_FILE_NAME:test-server>
|
||||
--port 1${PORT_HCM_SRV})
|
||||
endif()
|
||||
|
||||
set_tests_properties(st_hcm_srv PROPERTIES
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/http-server/minimal-http-server-tls
|
||||
FIXTURES_SETUP hcm_srv
|
||||
TIMEOUT 800)
|
||||
set_tests_properties(ki_hcm_srv PROPERTIES
|
||||
FIXTURES_CLEANUP hcm_srv)
|
||||
|
||||
set_tests_properties(st_hcmp_srv PROPERTIES
|
||||
WORKING_DIRECTORY .
|
||||
FIXTURES_SETUP hcmp_srv
|
||||
TIMEOUT 800)
|
||||
set_tests_properties(ki_hcmp_srv PROPERTIES
|
||||
FIXTURES_CLEANUP hcmp_srv)
|
||||
|
||||
#
|
||||
# Tests against local server peer
|
||||
#
|
||||
|
||||
add_test(NAME http-client-multi COMMAND lws-minimal-http-client-multi
|
||||
-l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-h1 COMMAND lws-minimal-http-client-multi
|
||||
--h1 -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-pipe COMMAND lws-minimal-http-client-multi
|
||||
-p -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-h1-pipe COMMAND lws-minimal-http-client-multi
|
||||
--h1 -p -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-stag COMMAND lws-minimal-http-client-multi
|
||||
-s -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-stag-h1 COMMAND lws-minimal-http-client-multi
|
||||
--h1 -s -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-stag-pipe COMMAND lws-minimal-http-client-multi
|
||||
-p -s -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-stag-h1-pipe COMMAND lws-minimal-http-client-multi
|
||||
--h1 -p -s -l --port ${PORT_HCM_SRV})
|
||||
|
||||
# confirm that the pipelined mode really is doing it in one connection
|
||||
add_test(NAME http-client-multi-restrict-pipe COMMAND lws-minimal-http-client-multi -d1151 --limit 1 -p -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-restrict-h1-pipe COMMAND lws-minimal-http-client-multi -d1151 --limit 1 --h1 -p -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-restrict-stag-pipe COMMAND lws-minimal-http-client-multi -d1151 --limit 1 -p -s -l --port ${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-restrict-stag-h1-pipe COMMAND lws-minimal-http-client-multi -d1151 --limit 1 --h1 -p -s -l --port ${PORT_HCM_SRV})
|
||||
# confirm that we do fail with a one connection limit and no pipelining
|
||||
add_test(NAME http-client-multi-restrict-nopipe-fail COMMAND lws-minimal-http-client-multi --limit 1 -l --port ${PORT_HCM_SRV})
|
||||
set_property(TEST http-client-multi-restrict-nopipe-fail PROPERTY WILL_FAIL TRUE)
|
||||
add_test(NAME http-client-multi-restrict-h1-nopipe-fail COMMAND lws-minimal-http-client-multi --limit 1 --h1 -l --port ${PORT_HCM_SRV})
|
||||
set_property(TEST http-client-multi-restrict-h1-nopipe-fail PROPERTY WILL_FAIL TRUE)
|
||||
|
||||
set_tests_properties(http-client-multi-restrict-pipe
|
||||
http-client-multi-restrict-h1-pipe
|
||||
http-client-multi-restrict-stag-pipe
|
||||
http-client-multi-restrict-stag-h1-pipe
|
||||
http-client-multi-restrict-nopipe-fail
|
||||
http-client-multi-restrict-h1-nopipe-fail
|
||||
http-client-multi
|
||||
http-client-multi-h1
|
||||
http-client-multi-pipe
|
||||
http-client-multi-h1-pipe
|
||||
http-client-multi-stag
|
||||
http-client-multi-stag-h1
|
||||
http-client-multi-stag-pipe
|
||||
http-client-multi-stag-h1-pipe
|
||||
PROPERTIES
|
||||
FIXTURES_REQUIRED "hcm_srv"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/http-client/minimal-http-client-multi
|
||||
TIMEOUT 20)
|
||||
|
||||
# POSTs against local http-server-form-post
|
||||
add_test(NAME http-client-multi-post COMMAND lws-minimal-http-client-multi
|
||||
--post -l --port 1${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-post-h1 COMMAND lws-minimal-http-client-multi
|
||||
--post --h1 -l --port 1${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-post-pipe COMMAND lws-minimal-http-client-multi
|
||||
--post -p -l --port 1${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-post-h1-pipe COMMAND lws-minimal-http-client-multi
|
||||
--post --h1 -p -l --port 1${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-post-stag COMMAND lws-minimal-http-client-multi
|
||||
--post -s -l -d1151 --port 1${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-post-stag-h1 COMMAND lws-minimal-http-client-multi
|
||||
--post --h1 -d1151 -s -l --port 1${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-post-stag-pipe COMMAND lws-minimal-http-client-multi
|
||||
--post -p -s -l --port 1${PORT_HCM_SRV})
|
||||
add_test(NAME http-client-multi-post-stag-h1-pipe COMMAND lws-minimal-http-client-multi
|
||||
--post --h1 -p -s -l --port 1${PORT_HCM_SRV})
|
||||
set_tests_properties(http-client-multi-post
|
||||
http-client-multi-post-h1
|
||||
http-client-multi-post-pipe
|
||||
http-client-multi-post-h1-pipe
|
||||
http-client-multi-post-stag
|
||||
http-client-multi-post-stag-h1
|
||||
http-client-multi-post-stag-pipe
|
||||
http-client-multi-post-stag-h1-pipe
|
||||
PROPERTIES
|
||||
FIXTURES_REQUIRED "hcmp_srv"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/http-client/minimal-http-client-multi
|
||||
TIMEOUT 20)
|
||||
|
||||
endif(NOT WIN32 AND LWS_WITH_SERVER)
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -132,7 +132,9 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
break;
|
||||
if (lws_http_is_redirected_to_get(wsi))
|
||||
break;
|
||||
lwsl_user("LWS_CALLBACK_CLIENT_HTTP_WRITEABLE: %p, part %d\n", wsi, pss->body_part);
|
||||
lwsl_info("LWS_CALLBACK_CLIENT_HTTP_WRITEABLE: %p, idx %d,"
|
||||
" part %d\n", wsi, idx, pss->body_part);
|
||||
|
||||
n = LWS_WRITE_HTTP;
|
||||
|
||||
/*
|
||||
|
@ -318,18 +320,14 @@ int main(int argc, const char **argv)
|
|||
{
|
||||
struct lws_context_creation_info info;
|
||||
unsigned long long start;
|
||||
int m, staggered = 0;
|
||||
const char *p;
|
||||
int m, staggered = 0, logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE
|
||||
/* for LLL_ verbosity above NOTICE to be built into lws,
|
||||
* lws must have been configured and built with
|
||||
* -DCMAKE_BUILD_TYPE=DEBUG instead of =RELEASE */
|
||||
/* | LLL_INFO */ /* | LLL_PARSER */ /* | LLL_HEADER */
|
||||
/* | LLL_EXT */ /* | LLL_CLIENT */ /* | LLL_LATENCY */
|
||||
/* | LLL_DEBUG */;
|
||||
|
||||
memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */
|
||||
memset(&i, 0, sizeof i); /* otherwise uninitialized garbage */
|
||||
|
||||
lws_cmdline_option_handle_builtin(argc, argv, &info);
|
||||
|
||||
info.signal_cb = signal_cb;
|
||||
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
|
||||
|
||||
|
@ -348,10 +346,7 @@ int main(int argc, const char **argv)
|
|||
signal(SIGINT, sigint_handler);
|
||||
|
||||
staggered = !!lws_cmdline_option(argc, argv, "-s");
|
||||
if ((p = lws_cmdline_option(argc, argv, "-d")))
|
||||
logs = atoi(p);
|
||||
|
||||
lws_set_log_level(logs, NULL);
|
||||
lwsl_user("LWS minimal http client [-s (staggered)] [-p (pipeline)]\n");
|
||||
lwsl_user(" [--h1 (http/1 only)] [-l (localhost)] [-d <logs>]\n");
|
||||
lwsl_user(" [-n (numbered)] [--post]\n");
|
||||
|
@ -424,6 +419,9 @@ int main(int argc, const char **argv)
|
|||
strcpy(urlpath, "/testserver/formtest");
|
||||
}
|
||||
|
||||
if (lws_cmdline_option(argc, argv, "--no-tls"))
|
||||
i.ssl_connection &= ~(LCCSCF_USE_SSL);
|
||||
|
||||
if (lws_cmdline_option(argc, argv, "-n"))
|
||||
numbered = 1;
|
||||
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=30
|
||||
|
||||
dotest $1 $2 warmcat
|
||||
dotest $1 $2 warmcat-pipe -p
|
||||
dotest $1 $2 warmcat-h1 --h1
|
||||
dotest $1 $2 warmcat-h1-pipe --h1 -p
|
||||
dotest $1 $2 warmcat-stag -s
|
||||
dotest $1 $2 warmcat-pipe-stag -p -s
|
||||
dotest $1 $2 warmcat-h1-stag --h1 -s
|
||||
dotest $1 $2 warmcat-h1-pipe-stag --h1 -p -s
|
||||
dotest $1 $2 warmcat-post --post
|
||||
dotest $1 $2 warmcat-post-pipe --post -p
|
||||
dotest $1 $2 warmcat-post-pipe-stag --post -p -s
|
||||
dotest $1 $2 warmcat-h1-post --post --h1
|
||||
dotest $1 $2 warmcat-h1-post-pipe --post --h1 -p
|
||||
dotest $1 $2 warmcat-h1-post-pipe-stag --post --h1 -p -s
|
||||
dotest $1 $2 warmcat-restrict-pipe --limit 1 -p
|
||||
dotest $1 $2 warmcat-restrict-h1-pipe --limit 1 -p --h1
|
||||
dotest $1 $2 warmcat-restrict-pipe-stag --limit 1 -p -s
|
||||
dotest $1 $2 warmcat-restrict-h1-pipe-stag --limit 1 -p --h1 -s
|
||||
dofailtest $1 $2 fail-warmcat-restrict --limit 1
|
||||
dofailtest $1 $2 fail-warmcat-restrict-h1 --limit 1 --h1
|
||||
dofailtest $1 $2 fail-warmcat-restrict-stag --limit 1 -s
|
||||
dofailtest $1 $2 fail-warmcat-restrict-h1-stag --limit 1 --h1 -s
|
||||
|
||||
spawn "" $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost -l
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-pipe -l -p
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-h1 -l --h1
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-h1-pipe -l --h1 -p
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-stag -l -s
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-pipe-stag -l -p -s
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-h1-stag -l --h1 -s
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-h1-pipe-stag -l --h1 -p -s
|
||||
|
||||
kill $SPID 2>/dev/null
|
||||
wait $SPID 2>/dev/null
|
||||
exit $FAILS
|
||||
|
|
@ -69,6 +69,72 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
#
|
||||
# instantiate the server per sai builder instance, they are running in the same
|
||||
# machine context in parallel so they can tread on each other otherwise
|
||||
#
|
||||
set(PORT_HCP_SRV "7640")
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "0")
|
||||
set(PORT_HCP_SRV 7641)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "1")
|
||||
set(PORT_HCP_SRV 7642)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "2")
|
||||
set(PORT_HCP_SRV 7643)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "3")
|
||||
set(PORT_HCP_SRV 7644)
|
||||
endif()
|
||||
|
||||
# hack
|
||||
if (NOT WIN32 AND LWS_WITH_SERVER)
|
||||
|
||||
#
|
||||
# Tests against built server running locally (needs daemonization...)
|
||||
#
|
||||
|
||||
if (WIN32)
|
||||
add_test(NAME st_hcp_srv COMMAND cmd.exe /c start /b $<TARGET_FILE:test-server> -s --port ${PORT_HCP_SRV})
|
||||
add_test(NAME ki_hcp_srv COMMAND taskkill /F /IM $<TARGET_FILE_NAME:test-server> /T)
|
||||
else()
|
||||
add_test(NAME st_hcp_srv COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background.sh
|
||||
hcp_srv
|
||||
$<TARGET_FILE:test-server>
|
||||
-r ${CMAKE_SOURCE_DIR}/destdir/usr/local/share/libwebsockets-test-server/
|
||||
-s --port ${PORT_HCP_SRV})
|
||||
add_test(NAME ki_hcp_srv COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background-kill.sh hcp_srv
|
||||
$<TARGET_FILE_NAME:test-server> --port ${PORT_HCP_SRV})
|
||||
endif()
|
||||
|
||||
set_tests_properties(st_hcp_srv PROPERTIES
|
||||
WORKING_DIRECTORY .
|
||||
FIXTURES_SETUP hcp_srv
|
||||
TIMEOUT 800)
|
||||
set_tests_properties(ki_hcp_srv PROPERTIES
|
||||
FIXTURES_CLEANUP hcp_srv)
|
||||
|
||||
add_test(NAME http-client-post COMMAND
|
||||
lws-minimal-http-client-post -l --port ${PORT_HCP_SRV})
|
||||
add_test(NAME http-client-post-m COMMAND
|
||||
lws-minimal-http-client-post -l -m --port ${PORT_HCP_SRV})
|
||||
add_test(NAME http-client-post-h1 COMMAND
|
||||
lws-minimal-http-client-post -l --h1 --port ${PORT_HCP_SRV})
|
||||
add_test(NAME http-client-post-m-h1 COMMAND
|
||||
lws-minimal-http-client-post -l -m --h1 --port ${PORT_HCP_SRV})
|
||||
set_tests_properties(http-client-post
|
||||
http-client-post-m
|
||||
http-client-post-h1
|
||||
http-client-post-m-h1
|
||||
PROPERTIES
|
||||
FIXTURES_REQUIRED "hcp_srv"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/http-client/minimal-http-client-post
|
||||
TIMEOUT 20)
|
||||
endif()
|
||||
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
|
|
@ -189,6 +189,7 @@ int main(int argc, const char **argv)
|
|||
struct lws_context_creation_info info;
|
||||
struct lws_client_connect_info i;
|
||||
struct lws_context *context;
|
||||
const char *p;
|
||||
int n = 0;
|
||||
|
||||
signal(SIGINT, sigint_handler);
|
||||
|
@ -245,6 +246,9 @@ int main(int argc, const char **argv)
|
|||
if (lws_cmdline_option(argc, argv, "--form1"))
|
||||
i.path = "/form1";
|
||||
|
||||
if ((p = lws_cmdline_option(argc, argv, "--port")))
|
||||
i.port = atoi(p);
|
||||
|
||||
i.host = i.address;
|
||||
i.origin = i.address;
|
||||
i.method = "POST";
|
||||
|
@ -257,6 +261,8 @@ int main(int argc, const char **argv)
|
|||
|
||||
for (n = 0; n < count_clients; n++) {
|
||||
i.pwsi = &client_wsi[n];
|
||||
lwsl_notice("%s: connecting to %s:%d\n", __func__,
|
||||
i.address, i.port);
|
||||
if (!lws_client_connect_via_info(&i))
|
||||
completed++;
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=8
|
||||
|
||||
dotest $1 $2 warmcat
|
||||
dotest $1 $2 warmcat-h1 --h1
|
||||
dotest $1 $2 warmcat-m -m
|
||||
dotest $1 $2 warmcat-m-h1 -m --h1
|
||||
|
||||
spawn "" $5 $1/libwebsockets-test-server -s
|
||||
dotest $1 $2 localhost -l -d1151
|
||||
spawn $SPID $5 $1/libwebsockets-test-server -s
|
||||
dotest $1 $2 localhost-h1 -l --h1
|
||||
spawn $SPID $5 $1/libwebsockets-test-server -s
|
||||
dotest $1 $2 localhost-m -l -m
|
||||
spawn $SPID $5 $1/libwebsockets-test-server -s
|
||||
dotest $1 $2 localhost-m-h1 -l -m --h1
|
||||
|
||||
kill $SPID 2>/dev/null
|
||||
wait $SPID 2>/dev/null
|
||||
exit $FAILS
|
|
@ -71,10 +71,21 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
|
||||
# if (LWS_CTEST_INTERNET_AVAILABLE)
|
||||
# add_test(NAME http-client-warmcat COMMAND lws-minimal-http-client --ignore-sigterm)
|
||||
# add_test(NAME http-client-warmcat-h1 COMMAND lws-minimal-http-client --ignore-sigterm --h1)
|
||||
# set_tests_properties(http-client-warmcat
|
||||
# http-client-warmcat-h1
|
||||
# PROPERTIES
|
||||
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/http-client/minimal-http-client
|
||||
# TIMEOUT 20)
|
||||
#
|
||||
#endif()
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
add_dependencies(${SAMP} websockets_shared)
|
||||
else()
|
||||
target_link_libraries(${SAMP} websockets)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=4
|
||||
|
||||
dotest $1 $2 warmcat
|
||||
dotest $1 $2 warmcat-h1 --h1
|
||||
|
||||
spawn "" $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost -l
|
||||
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
||||
dotest $1 $2 localhost-h1 -l --h1
|
||||
|
||||
kill $SPID 2>/dev/null
|
||||
wait $SPID 2>/dev/null
|
||||
exit $FAILS
|
|
@ -202,6 +202,9 @@ int main(int argc, const char **argv)
|
|||
info.ssl_private_key_filepath = "localhost-100y.key";
|
||||
}
|
||||
|
||||
if ((p = lws_cmdline_option(argc, argv, "--port")))
|
||||
info.port = atoi(p);
|
||||
|
||||
if (lws_cmdline_option(argc, argv, "--303")) {
|
||||
lwsl_user("%s: using 303 redirect\n", __func__);
|
||||
use303 = 1;
|
||||
|
|
|
@ -52,24 +52,17 @@ int main(int argc, const char **argv)
|
|||
struct lws_context_creation_info info;
|
||||
struct lws_context *context;
|
||||
const char *p;
|
||||
int n = 0, logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE
|
||||
/* for LLL_ verbosity above NOTICE to be built into lws,
|
||||
* lws must have been configured and built with
|
||||
* -DCMAKE_BUILD_TYPE=DEBUG instead of =RELEASE */
|
||||
/* | LLL_INFO */ /* | LLL_PARSER */ /* | LLL_HEADER */
|
||||
/* | LLL_EXT */ /* | LLL_CLIENT */ /* | LLL_LATENCY */
|
||||
/* | LLL_DEBUG */;
|
||||
|
||||
if ((p = lws_cmdline_option(argc, argv, "-d")))
|
||||
logs = atoi(p);
|
||||
|
||||
lws_set_log_level(logs, NULL);
|
||||
lwsl_user("LWS minimal http server TLS | visit https://localhost:7681\n");
|
||||
int n = 0;
|
||||
|
||||
signal(SIGINT, sigint_handler);
|
||||
|
||||
memset(&info, 0, sizeof info); /* otherwise uninitialized garbage */
|
||||
lws_cmdline_option_handle_builtin(argc, argv, &info);
|
||||
lwsl_user("LWS minimal http server TLS | visit https://localhost:7681\n");
|
||||
|
||||
info.port = 7681;
|
||||
if ((p = lws_cmdline_option(argc, argv, "--port")))
|
||||
info.port = atoi(p);
|
||||
info.mounts = &mount;
|
||||
info.error_document_404 = "/404.html";
|
||||
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT |
|
||||
|
|
|
@ -1,110 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" -o -z "$2" ] ; then
|
||||
echo "required args missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IDX=$3
|
||||
TOT=$4
|
||||
MYTEST=`echo $0 | sed "s/\/[^\/]*\$//g" |sed "s/.*\///g"`
|
||||
mkdir -p $2/$MYTEST
|
||||
rm -f $2/$MYTEST/*.log $2/$MYTEST/*.result
|
||||
FAILS=0
|
||||
WHICH=$IDX
|
||||
SPID=
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
SCRIPT_DIR=`readlink -f $SCRIPT_DIR`
|
||||
LOGPATH=$2
|
||||
|
||||
feedback() {
|
||||
if [ "$2" != "$4" ] ; then
|
||||
FAILS=$(( $FAILS + 1 ))
|
||||
echo -n -e "\e[31m"
|
||||
fi
|
||||
T=" --- killed --- "
|
||||
if [ ! -z "`cat $LOGPATH/$MYTEST/$3.time`" ] ; then
|
||||
T="`cat $LOGPATH/$MYTEST/$3.time | grep real | sed "s/.*\ //g"`"
|
||||
T="$T `cat $LOGPATH/$MYTEST/$3.time | grep user | sed "s/.*\ //g"`"
|
||||
T="$T `cat $LOGPATH/$MYTEST/$3.time | grep sys | sed "s/.*\ //g"`"
|
||||
fi
|
||||
printf "%-35s [ %3s/%3s ]: %3s : %8s : %s\n" $1 $WHICH $TOT $2 "$T" $3
|
||||
if [ "$2" != "0" ] ; then
|
||||
echo -n -e "\e[0m"
|
||||
fi
|
||||
WHICH=$(( $WHICH + 1))
|
||||
}
|
||||
|
||||
spawn() {
|
||||
if [ ! -z "$1" ] ; then
|
||||
if [ `ps $1 | wc -l` -eq 2 ]; then
|
||||
# echo "prerequisite still up"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
QQ=`pwd`
|
||||
cd $SCRIPT_DIR
|
||||
cd $2
|
||||
$3 $4 $5 > $LOGPATH/$MYTEST/serverside.log 2> $LOGPATH/$MYTEST/serverside.log &
|
||||
SPID=$!
|
||||
cd $QQ
|
||||
sleep 0.5s
|
||||
# echo "launched prerequisite $SPID"
|
||||
}
|
||||
|
||||
_dotest() {
|
||||
EXPRES=0
|
||||
if [ ! -z "$4" ] ; then
|
||||
EXPRES=$4
|
||||
fi
|
||||
T=$3
|
||||
# echo "$1/lws-$MYTEST $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14}"
|
||||
(
|
||||
{
|
||||
/usr/bin/time -p /usr/bin/valgrind -q $1/lws-$MYTEST $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} > $2/$MYTEST/$T.log 2> $2/$MYTEST/$T.log ;
|
||||
echo $? > $2/$MYTEST/$T.result
|
||||
} 2> $2/$MYTEST/$T.time >/dev/null
|
||||
) >/dev/null 2> /dev/null &
|
||||
W=$!
|
||||
WT=0
|
||||
while [ $WT -le 820 ] ; do
|
||||
kill -0 $W 2>/dev/null
|
||||
if [ $? -ne 0 ] ; then
|
||||
WT=10000
|
||||
else
|
||||
if [ $WT -ge 800 ] ; then
|
||||
WT=10000
|
||||
kill $W 2>/dev/null
|
||||
wait $W 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
sleep 0.1s
|
||||
WT=$(( $WT + 1 ))
|
||||
done
|
||||
|
||||
R=254
|
||||
if [ -e $2/$MYTEST/$T.result ] ; then
|
||||
R=`cat $2/$MYTEST/$T.result`
|
||||
cat $2/$MYTEST/$T.log | tail -n 3 > $2/$MYTEST/$T.time
|
||||
if [ $R -ne $EXPRES ] ; then
|
||||
pwd
|
||||
echo Expected result $EXPRES but got $R
|
||||
echo
|
||||
cat $2/$MYTEST/$T.log
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
feedback $MYTEST $R $T $EXPRES
|
||||
}
|
||||
|
||||
dotest()
|
||||
{
|
||||
_dotest $1 $2 $3 0 "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" "${13}"
|
||||
}
|
||||
|
||||
dofailtest()
|
||||
{
|
||||
_dotest $1 $2 $3 1 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# run this from your build dir having configured
|
||||
# -DLWS_WITH_MINIMAL_EXAMPLES=1 to get all the examples
|
||||
# that apply built into ./bin
|
||||
#
|
||||
# Eg,
|
||||
#
|
||||
# build $ ../minimal-examples/selftests.sh
|
||||
|
||||
echo
|
||||
echo "----------------------------------------------"
|
||||
echo "------- tests: lws minimal example selftests"
|
||||
echo
|
||||
|
||||
LOGGING_PATH=/tmp/logs
|
||||
|
||||
# for mebedtls, we need the CA certs in ./build where we run from
|
||||
|
||||
cp ../minimal-examples/http-client/minimal-http-client-multi/warmcat.com.cer .
|
||||
cp ../minimal-examples/http-client/minimal-http-client-post/libwebsockets.org.cer .
|
||||
|
||||
MINEX=`dirname $0`
|
||||
MINEX=`realpath $MINEX`
|
||||
TESTS=0
|
||||
for i in `find $MINEX -name selftest.sh` ; do
|
||||
BN=`echo -n "$i" | sed "s/\/[^\/]*\$//g" | sed "s/.*\///g"`
|
||||
if [ -e `pwd`/bin/lws-$BN ] ; then
|
||||
C=`cat $i | grep COUNT_TESTS= | cut -d= -f2`
|
||||
TESTS=$(( $TESTS + $C ))
|
||||
fi
|
||||
done
|
||||
|
||||
FAILS=0
|
||||
WH=1
|
||||
|
||||
for i in `find $MINEX -name selftest.sh` ; do
|
||||
BN=`echo -n "$i" | sed "s/\/[^\/]*\$//g" | sed "s/.*\///g"`
|
||||
if [ -e `pwd`/bin/lws-$BN ] ; then
|
||||
C=`cat $i | grep COUNT_TESTS= | cut -d= -f2`
|
||||
sh $i `pwd`/bin $LOGGING_PATH $WH $TESTS $MINEX
|
||||
FAILS=$(( $FAILS + $? ))
|
||||
|
||||
L=`ps fax | grep lws- | cut -d' ' -f2`
|
||||
kill $L 2>/dev/null
|
||||
kill -9 $L 2>/dev/null
|
||||
wait $L 2>/dev/null
|
||||
|
||||
WH=$(( $WH + $C ))
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAILS -eq 0 ] ; then
|
||||
echo "All $TESTS passed"
|
||||
exit 0
|
||||
else
|
||||
echo "Failed: $FAILS / $TESTS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -69,6 +69,14 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
if (LWS_CTEST_INTERNET_AVAILABLE)
|
||||
add_test(NAME ws-client-rx-warmcat COMMAND lws-minimal-ws-client-rx -t)
|
||||
set_tests_properties(ws-client-rx-warmcat
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/ws-client/minimal-ws-client-rx
|
||||
TIMEOUT 20)
|
||||
|
||||
endif()
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared)
|
||||
|
@ -76,4 +84,4 @@ if (requirements)
|
|||
else()
|
||||
target_link_libraries(${SAMP} websockets)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 warmcat -t
|
||||
|
||||
exit $FAILS
|
|
@ -89,6 +89,53 @@ require_lws_config(LWS_WITH_CLIENT 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${SAMP} ${SRCS})
|
||||
#
|
||||
# instantiate the server per sai builder instance, they are running in the same
|
||||
# machine context in parallel so they can tread on each other otherwise
|
||||
#
|
||||
set(PORT_WCS_SRV "7620")
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "0")
|
||||
set(PORT_WCS_SRV 7621)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "1")
|
||||
set(PORT_WCS_SRV 7622)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "2")
|
||||
set(PORT_WCS_SRV 7623)
|
||||
endif()
|
||||
if ("$ENV{SAI_INSTANCE_IDX}" STREQUAL "3")
|
||||
set(PORT_WCS_SRV 7624)
|
||||
endif()
|
||||
|
||||
# hack
|
||||
if (WIN32)
|
||||
else()
|
||||
|
||||
if (LWS_WITH_SERVER)
|
||||
if (WIN32)
|
||||
add_test(NAME st_wcs_srv COMMAND cmd.exe /c start /b $<TARGET_FILE:test-server> -s --port ${PORT_WCS_SRV})
|
||||
add_test(NAME ki_wcs_srv COMMAND taskkill /F /IM $<TARGET_FILE_NAME:test-server> /T)
|
||||
else()
|
||||
add_test(NAME st_wcs_srv COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background.sh
|
||||
wcs_srv $<TARGET_FILE:test-server>
|
||||
-r ${CMAKE_SOURCE_DIR}/destdir/usr/local/share/libwebsockets-test-server/
|
||||
-s --port ${PORT_WCS_SRV})
|
||||
add_test(NAME ki_wcs_srv COMMAND
|
||||
${CMAKE_SOURCE_DIR}/scripts/ctest-background-kill.sh
|
||||
wcs_srv $<TARGET_FILE_NAME:test-server> --port ${PORT_WCS_SRV})
|
||||
endif()
|
||||
|
||||
set_tests_properties(st_wcs_srv PROPERTIES WORKING_DIRECTORY . FIXTURES_SETUP wcs_srv TIMEOUT 800)
|
||||
set_tests_properties(ki_wcs_srv PROPERTIES FIXTURES_CLEANUP wcs_srv)
|
||||
|
||||
add_test(NAME ws-client-spam COMMAND lws-minimal-ws-client-spam --server localhost --port ${PORT_WCS_SRV} -l 32 -c 3)
|
||||
set_tests_properties(ws-client-spam PROPERTIES
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/ws-client/minimal-ws-client-spam
|
||||
FIXTURES_REQUIRED "wcs_srv"
|
||||
TIMEOUT 40)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (websockets_shared)
|
||||
target_link_libraries(${SAMP} websockets_shared ${PTHREAD_LIB})
|
||||
|
|
|
@ -70,6 +70,7 @@ connect_client(int idx)
|
|||
clients[idx].state = CLIENT_CONNECTING;
|
||||
tries++;
|
||||
|
||||
lwsl_notice("%s: connection %s:%d\n", __func__, i.address, i.port);
|
||||
if (!lws_client_connect_via_info(&i)) {
|
||||
clients[idx].wsi = NULL;
|
||||
clients[idx].state = CLIENT_IDLE;
|
||||
|
@ -258,6 +259,8 @@ int main(int argc, const char **argv)
|
|||
while (n >= 0 && !interrupted)
|
||||
n = lws_service(context, 0);
|
||||
|
||||
lwsl_notice("%s: exiting service loop\n", __func__);
|
||||
|
||||
lws_context_destroy(context);
|
||||
|
||||
if (tries == limit && closed == tries) {
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $1: path to minimal example binaries...
|
||||
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
# that will be ./bin from your build dir
|
||||
#
|
||||
# $2: path for logs and results. The results will go
|
||||
# in a subdir named after the directory this script
|
||||
# is in
|
||||
#
|
||||
# $3: offset for test index count
|
||||
#
|
||||
# $4: total test count
|
||||
#
|
||||
# $5: path to ./minimal-examples dir in lws
|
||||
#
|
||||
# Test return code 0: OK, 254: timed out, other: error indication
|
||||
|
||||
. $5/selftests-library.sh
|
||||
|
||||
COUNT_TESTS=1
|
||||
|
||||
dotest $1 $2 warmcat
|
||||
|
||||
exit $FAILS
|
||||
|
|
@ -206,6 +206,15 @@ callback_lws_mirror(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
switch (reason) {
|
||||
case LWS_CALLBACK_ESTABLISHED:
|
||||
lwsl_info("%s: LWS_CALLBACK_ESTABLISHED\n", __func__);
|
||||
if (!v) {
|
||||
lws_protocol_vh_priv_zalloc(lws_get_vhost(wsi),
|
||||
lws_get_protocol(wsi),
|
||||
sizeof(struct per_vhost_data__lws_mirror));
|
||||
v = (struct per_vhost_data__lws_mirror *)
|
||||
lws_protocol_vh_priv_get(lws_get_vhost(wsi),
|
||||
lws_get_protocol(wsi));
|
||||
lws_pthread_mutex_init(&v->lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* mirror instance name... defaults to "", but if URL includes
|
||||
|
@ -332,13 +341,15 @@ bail1:
|
|||
return 1; /* disallow compression */
|
||||
|
||||
case LWS_CALLBACK_PROTOCOL_INIT: /* per vhost */
|
||||
lws_protocol_vh_priv_zalloc(lws_get_vhost(wsi),
|
||||
if (!v) {
|
||||
lws_protocol_vh_priv_zalloc(lws_get_vhost(wsi),
|
||||
lws_get_protocol(wsi),
|
||||
sizeof(struct per_vhost_data__lws_mirror));
|
||||
v = (struct per_vhost_data__lws_mirror *)
|
||||
v = (struct per_vhost_data__lws_mirror *)
|
||||
lws_protocol_vh_priv_get(lws_get_vhost(wsi),
|
||||
lws_get_protocol(wsi));
|
||||
lws_pthread_mutex_init(&v->lock);
|
||||
lws_pthread_mutex_init(&v->lock);
|
||||
}
|
||||
break;
|
||||
|
||||
case LWS_CALLBACK_PROTOCOL_DESTROY:
|
||||
|
|
54
scripts/ctest-background-kill.sh
Executable file
54
scripts/ctest-background-kill.sh
Executable file
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $SAI_INSTANCE_IDX - which instance of sai, 0+
|
||||
# $1 - background fixture name, unique within test space, like "multipostlocalsrv"
|
||||
# $2 - executable
|
||||
# $3+ - args
|
||||
|
||||
echo "$0 $1 $2 $3 $4" >> /tmp/ctklog
|
||||
|
||||
J=`basename $2`.$1.$SAI_INSTANCE_IDX
|
||||
PI=`cat /tmp/sai-ctest-$J`
|
||||
echo "Stage 1 kill $J 'kill $PI'" >> /tmp/ctklog
|
||||
|
||||
#
|
||||
# We expect our background process to still be around
|
||||
#
|
||||
|
||||
set +e
|
||||
set +E
|
||||
kill -0 $PI 2>&1 >> /tmp/ctklog
|
||||
GONESKI=$?
|
||||
|
||||
if [ $GONESKI -eq 0 ] ; then
|
||||
kill $PI 2>&1 >> /tmp/ctklog
|
||||
kill -9 $PI 2>&1 >> /tmp/ctklog
|
||||
|
||||
kill -0 $PI 2>&1
|
||||
if [ $? -eq 0 ] ; then
|
||||
#
|
||||
# but in case it isn't enough, use ps to find the same executable started on the same port
|
||||
# and kill that
|
||||
#
|
||||
A1=$3
|
||||
if [ -z "$A1" ] ; then
|
||||
A1=$2
|
||||
fi
|
||||
A2=$4
|
||||
if [ -z "$A2" ] ; then
|
||||
A2=$2
|
||||
fi
|
||||
|
||||
# sed is there to match up bsd/osx ps with linux
|
||||
KL=`ps -Af | grep -v ctest-background-kill | grep -v grep | grep $2 | grep $A1 | grep $A2 | tr -s ' ' | sed "s/^\ //g" | cut -d' ' -f2`
|
||||
if [ ! -z "$KL" ] ; then
|
||||
echo "Stage 2 kill $J 'kill $KL'" >> /tmp/ctklog
|
||||
kill $KL 2>&1 >> /tmp/ctklog
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Process already dead" >> /tmp/ctklog
|
||||
fi
|
||||
|
||||
exit $GONESKI
|
||||
|
16
scripts/ctest-background.sh
Executable file
16
scripts/ctest-background.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# $SAI_INSTANCE_IDX - which instance of sai, 0+
|
||||
# $1 - background fixture name, unique within test space, like "multipostlocalserver"
|
||||
# $2 - executable
|
||||
# $3+ - args
|
||||
|
||||
J=`basename $2`.$1.$SAI_INSTANCE_IDX
|
||||
$2 $3 $4 $5 $6 $7 $8 $9 2>/tmp/ctest-background-$J 1>/dev/null 0</dev/null &
|
||||
echo $! > /tmp/sai-ctest-$J
|
||||
# really we want to loop until the listen port is up
|
||||
# on, eg, rpi it can be blocked at sd card and slow to start
|
||||
# due to parallel tests and disc cache flush
|
||||
sleep 1
|
||||
exit 0
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
Name: libwebsockets
|
||||
Version: 4.0.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Websocket Server and Client Library
|
||||
|
||||
Group: System Environment/Libraries
|
||||
License: MIT
|
||||
URL: https://libwebsockets.org
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
|
||||
BuildRequires: openssl-devel libuv-devel libev-devel cmake
|
||||
Requires: openssl
|
||||
|
||||
%description
|
||||
Webserver server and client library
|
||||
|
||||
%package devel
|
||||
Summary: Development files for libwebsockets
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: openssl-devel
|
||||
|
||||
%description devel
|
||||
Development files for libwebsockets
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
mkdir -p build
|
||||
cd build
|
||||
%cmake .. -DLWS_WITH_DISTRO_RECOMMENDED=1
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
cd build
|
||||
make install DESTDIR=$RPM_BUILD_ROOT
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%attr(755,root,root)
|
||||
"/usr/bin/libwebsockets-test-client"
|
||||
"/usr/bin/libwebsockets-test-lejp"
|
||||
"/usr/bin/libwebsockets-test-server"
|
||||
"/usr/bin/libwebsockets-test-server-extpoll"
|
||||
"/usr/bin/libwebsockets-test-sshd"
|
||||
"/usr/bin/lwsws"
|
||||
"/%{_libdir}/libwebsockets.so"
|
||||
"/%{_libdir}/libwebsockets.so.16"
|
||||
%dir "/usr/share/libwebsockets-test-server"
|
||||
"/usr/share/libwebsockets-test-server/candide.zip"
|
||||
"/usr/share/libwebsockets-test-server/favicon.ico"
|
||||
%dir "/usr/share/libwebsockets-test-server/generic-table"
|
||||
"/usr/share/libwebsockets-test-server/generic-table/index.html"
|
||||
"/usr/share/libwebsockets-test-server/generic-table/lwsgt.js"
|
||||
"/usr/share/libwebsockets-test-server/http2.png"
|
||||
"/usr/share/libwebsockets-test-server/leaf.jpg"
|
||||
"/usr/share/libwebsockets-test-server/libwebsockets-test-server.key.pem"
|
||||
"/usr/share/libwebsockets-test-server/libwebsockets-test-server.pem"
|
||||
"/usr/share/libwebsockets-test-server/libwebsockets.org-logo.svg"
|
||||
"/usr/share/libwebsockets-test-server/lws-cgi-test.sh"
|
||||
"/usr/share/libwebsockets-test-server/lws-common.js"
|
||||
"/usr/share/libwebsockets-test-server/lws-ssh-test-keys"
|
||||
"/usr/share/libwebsockets-test-server/lws-ssh-test-keys.pub"
|
||||
%dir "/usr/share/libwebsockets-test-server/plugins"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_client_loopback_test.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_dumb_increment.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_fulltext_demo.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_lws_acme_client.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_lws_mirror.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_lws_raw_test.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_lws_server_status.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_lws_ssh_base.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_lws_sshd_demo.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_lws_status.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_lws_table_dirlisting.so"
|
||||
"/usr/share/libwebsockets-test-server/plugins/libprotocol_post_demo.so"
|
||||
%dir "/usr/share/libwebsockets-test-server/private"
|
||||
"/usr/share/libwebsockets-test-server/private/index.html"
|
||||
%dir "/usr/share/libwebsockets-test-server/server-status"
|
||||
"/usr/share/libwebsockets-test-server/server-status/lwsws-logo.png"
|
||||
"/usr/share/libwebsockets-test-server/server-status/server-status.css"
|
||||
"/usr/share/libwebsockets-test-server/server-status/server-status.html"
|
||||
"/usr/share/libwebsockets-test-server/server-status/server-status.js"
|
||||
"/usr/share/libwebsockets-test-server/test.css"
|
||||
"/usr/share/libwebsockets-test-server/test.html"
|
||||
"/usr/share/libwebsockets-test-server/test.js"
|
||||
"/usr/share/libwebsockets-test-server/wss-over-h2.png"
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%dir "/usr/include/libwebsockets"
|
||||
"/usr/include/libwebsockets.h"
|
||||
"/usr/include/libwebsockets/lws-adopt.h"
|
||||
"/usr/include/libwebsockets/lws-callbacks.h"
|
||||
"/usr/include/libwebsockets/lws-cgi.h"
|
||||
"/usr/include/libwebsockets/lws-client.h"
|
||||
"/usr/include/libwebsockets/lws-context-vhost.h"
|
||||
"/usr/include/libwebsockets/lws-dbus.h"
|
||||
"/usr/include/libwebsockets/lws-diskcache.h"
|
||||
"/usr/include/libwebsockets/lws-esp32.h"
|
||||
"/usr/include/libwebsockets/lws-fts.h"
|
||||
"/usr/include/libwebsockets/lws-genhash.h"
|
||||
"/usr/include/libwebsockets/lws-genrsa.h"
|
||||
"/usr/include/libwebsockets/lws-http.h"
|
||||
"/usr/include/libwebsockets/lws-jose.h"
|
||||
"/usr/include/libwebsockets/lws-jwk.h"
|
||||
"/usr/include/libwebsockets/lws-jws.h"
|
||||
"/usr/include/libwebsockets/lws-lejp.h"
|
||||
"/usr/include/libwebsockets/lws-logs.h"
|
||||
"/usr/include/libwebsockets/lws-lwsac.h"
|
||||
"/usr/include/libwebsockets/lws-misc.h"
|
||||
"/usr/include/libwebsockets/lws-network-helper.h"
|
||||
"/usr/include/libwebsockets/lws-plugin-generic-sessions.h"
|
||||
"/usr/include/libwebsockets/lws-protocols-plugins.h"
|
||||
"/usr/include/libwebsockets/lws-purify.h"
|
||||
"/usr/include/libwebsockets/lws-ring.h"
|
||||
"/usr/include/libwebsockets/lws-service.h"
|
||||
"/usr/include/libwebsockets/lws-sha1-base64.h"
|
||||
"/usr/include/libwebsockets/lws-spa.h"
|
||||
"/usr/include/libwebsockets/lws-stats.h"
|
||||
"/usr/include/libwebsockets/lws-threadpool.h"
|
||||
"/usr/include/libwebsockets/lws-timeout-timer.h"
|
||||
"/usr/include/libwebsockets/lws-tokenize.h"
|
||||
"/usr/include/libwebsockets/lws-vfs.h"
|
||||
"/usr/include/libwebsockets/lws-write.h"
|
||||
"/usr/include/libwebsockets/lws-writeable.h"
|
||||
"/usr/include/libwebsockets/lws-ws-close.h"
|
||||
"/usr/include/libwebsockets/lws-ws-ext.h"
|
||||
"/usr/include/libwebsockets/lws-ws-state.h"
|
||||
"/usr/include/libwebsockets/lws-x509.h"
|
||||
"/usr/include/lws-plugin-ssh.h"
|
||||
"/usr/include/lws_config.h"
|
||||
%dir "/usr/lib/pkgconfig"
|
||||
"/%{_libdir}/pkgconfig/libwebsockets.pc"
|
||||
"/usr/lib/pkgconfig/libwebsockets_static.pc"
|
||||
%dir "/usr/lib/cmake"
|
||||
%dir "/usr/lib/cmake/libwebsockets"
|
||||
"/%{_libdir}/cmake/libwebsockets/LibwebsocketsConfig.cmake"
|
||||
"/%{_libdir}/cmake/libwebsockets/LibwebsocketsConfigVersion.cmake"
|
||||
"/%{_libdir}/cmake/libwebsockets/LibwebsocketsTargets-debug.cmake"
|
||||
"/%{_libdir}/cmake/libwebsockets/LibwebsocketsTargets.cmake"
|
||||
|
||||
%changelog
|
||||
* Fri Aug 14 2019 Andy Green <andy@warmcat.com> 3.2.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 3.2.0 release (last LGPLv2.1+SLE)
|
||||
|
||||
* Fri Nov 23 2018 Andy Green <andy@warmcat.com> 3.1.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 3.1.0 release
|
||||
|
||||
* Fri May 4 2018 Andy Green <andy@warmcat.com> 3.0.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 3.0.0 release
|
||||
|
||||
* Mon Oct 16 2017 Andy Green <andy@warmcat.com> 2.4.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 2.4.0 release
|
||||
|
||||
* Fri Jul 28 2017 Andy Green <andy@warmcat.com> 2.3.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 2.3.0 release
|
||||
|
||||
* Mon Mar 06 2017 Andy Green <andy@warmcat.com> 2.2.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 2.2.0 release
|
||||
|
||||
* Thu Oct 06 2016 Andy Green <andy@warmcat.com> 2.1.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 2.1.0 release
|
||||
|
||||
* Thu May 05 2016 Andy Green <andy@warmcat.com> 2.0.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 2.0.0 release
|
||||
|
||||
* Tue Feb 16 2016 Andy Green <andy@warmcat.com> 1.7.0-1
|
||||
- MAJOR SONAMEBUMP APICHANGES Upstream 1.7.0 release
|
||||
|
||||
* Sun Jan 17 2016 Andrew Cooks <acooks@linux.com> 1.6.0-1
|
||||
- Bump version to 1.6.0
|
|
@ -317,6 +317,7 @@ static struct option options[] = {
|
|||
{ "ssl-cert", required_argument, NULL, 'C' },
|
||||
{ "ssl-key", required_argument, NULL, 'K' },
|
||||
{ "ssl-ca", required_argument, NULL, 'A' },
|
||||
{ "resource-path", required_argument, NULL, 'r' },
|
||||
#if defined(LWS_WITH_TLS)
|
||||
{ "ssl-verify-client", no_argument, NULL, 'v' },
|
||||
#if defined(LWS_HAVE_SSL_CTX_set1_param)
|
||||
|
@ -329,10 +330,17 @@ static struct option options[] = {
|
|||
{ "daemonize", no_argument, NULL, 'D' },
|
||||
#endif
|
||||
{ "pingpong-secs", required_argument, NULL, 'P' },
|
||||
{ "ignore-sigterm", no_argument, NULL, 'I' },
|
||||
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
||||
static void
|
||||
sigterm_catch(int sig)
|
||||
{
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct lws_context_creation_info info;
|
||||
|
@ -360,9 +368,9 @@ int main(int argc, char **argv)
|
|||
|
||||
while (n >= 0) {
|
||||
#if defined(LWS_HAS_GETOPT_LONG) || defined(WIN32)
|
||||
n = getopt_long(argc, argv, "eci:hsap:d:DC:K:A:R:vu:g:P:kU:n", options, NULL);
|
||||
n = getopt_long(argc, argv, "eci:hsap:d:DC:K:A:R:vu:g:P:kU:niIr:", options, NULL);
|
||||
#else
|
||||
n = getopt(argc, argv, "eci:hsap:d:DC:K:A:R:vu:g:P:kU:n");
|
||||
n = getopt(argc, argv, "eci:hsap:d:DC:K:A:R:vu:g:P:kU:nIr:");
|
||||
#endif
|
||||
if (n < 0)
|
||||
continue;
|
||||
|
@ -388,6 +396,12 @@ int main(int argc, char **argv)
|
|||
/* no dumb increment send */
|
||||
test_options |= 1;
|
||||
break;
|
||||
case 'I':
|
||||
signal(SIGTERM, sigterm_catch);
|
||||
break;
|
||||
case 'r':
|
||||
resource_path = optarg;
|
||||
break;
|
||||
case 's':
|
||||
use_ssl = 1;
|
||||
opts |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
|
||||
|
@ -539,8 +553,8 @@ int main(int argc, char **argv)
|
|||
"!AES256-GCM-SHA384:"
|
||||
"!AES256-SHA256";
|
||||
info.mounts = &mount;
|
||||
info.ip_limit_ah = 24; /* for testing */
|
||||
info.ip_limit_wsi = 400; /* for testing */
|
||||
info.ip_limit_ah = 128; /* for testing */
|
||||
info.ip_limit_wsi = 800; /* for testing */
|
||||
|
||||
if (use_ssl)
|
||||
/* redirect guys coming on http */
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#include <winver.h>
|
||||
|
||||
#define LWS_NUMVERSION @LWS_LIBRARY_VERSION_MAJOR@,@LWS_LIBRARY_VERSION_MINOR@,0
|
||||
#define LWS_VERSION @LWS_LIBRARY_VERSION_MAJOR@,@LWS_LIBRARY_VERSION_MINOR@,@LWS_LIBRARY_VERSION_PATCH@,0
|
||||
#define LWS_VERSION_STR "@LWS_LIBRARY_VERSION_MAJOR@.@LWS_LIBRARY_VERSION_MINOR@.@LWS_LIBRARY_VERSION_PATCH@\0"
|
||||
#define LWS_PACKAGE_NAME "@PACKAGE@\0"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION LWS_VERSION
|
||||
PRODUCTVERSION LWS_VERSION
|
||||
FILEVERSION LWS_NUMVERSION
|
||||
PRODUCTVERSION LWS_NUMVERSION
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS__WINDOWS32
|
||||
|
|
Loading…
Add table
Reference in a new issue