mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
![]() Establish a new distributed CMake architecture with CMake code related to a source directory moving to be in the subdir in its own CMakeLists.txt. In particular, there's now one in ./lib which calls through to ones further down the directory tree like ./lib/plat/xxx, ./lib/roles/xxx etc. This cuts the main CMakelists.txt from 98KB -> 33KB, about a 66% reduction, and it's much easier to maintain sub-CMakeLists.txt that are in the same directory as the sources they manage, and conceal all the details that that level. Child CMakelists.txt become responsible for: - include_directories() definition (this is not supported by CMake directly, it passes it back up via PARENT_SCOPE vars in helper macros) - Addition child CMakeLists.txt inclusion, for example toplevel -> role -> role subdir - Source file addition to the build - Dependent library path resolution... this is now a private thing in the child CMakeLists.txt, it just passes back any adaptations to include_directories() and the LIB_LIST without filling the parent namespace with the details |
||
---|---|---|
.. | ||
mount-origin | ||
CMakeLists.txt | ||
localhost-100y.cert | ||
localhost-100y.key | ||
minimal-raw-fallback-http-server.c | ||
README.md |
lws minimal raw fallback http server
This is the same as the minimal http server, with one difference... if you connect to localhost:7681 with something that doesn't send recognizable http, then the connection will be switched to a raw-skt role and bind to a protocol that echoes anything sent back to the sender.
build
$ cmake . && make
usage
Commandline option | Meaning |
---|---|
-d | Debug verbosity in decimal, eg, -d15 |
-s | Configure the server for tls / https and LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT |
-h | (needs -s) Configure the vhost also for LWS_SERVER_OPTION_ALLOW_HTTP_ON_HTTPS_LISTENER , allowing http service on tls port (caution... it's insecure then) |
-u | (needs -s) Configure the vhost also for LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS , so the server issues a redirect to https to clients that attempt to connect to a server configured for tls with http. |
$ ./lws-minimal-raw-fallback-http-server
[2018/11/29 14:27:34:3014] USER: LWS minimal raw fallback http server | visit http://localhost:7681
[2018/11/29 14:27:34:3243] NOTICE: Creating Vhost 'default' port 7681, 1 protocols, IPv6 off
Visit http://127.0.0.1:7681
This allows testing of various combinations of special features for unexpected content on an http(s) listening socket.
cmdline args | http://127.0.0.1:7681 | https://127.0.0.1:7681 | ssh -p7681 127.0.0.1 | flags |
---|---|---|---|---|
none | served | no tls | echos hello | LWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFIG |
-s | echos http GET | served | echos hello | LWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFIG, LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT |
-s -h | served | served | echos hello | LWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFIG, LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT, LWS_SERVER_OPTION_ALLOW_HTTP_ON_HTTPS_LISTENER |
-s -u | redirected to https | served | echos hello | LWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFIG, LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT, LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS |