tree: b69840dfa1ef5eaa62dea349d4a7ed8916089caf [path history] [tgz]
  1. mount-origin/
  2. CMakeLists.txt
  3. localhost-100y.cert
  4. localhost-100y.key
  5. minimal-raw-fallback-http-server.c
  6. README.md
minimal-examples/raw/minimal-raw-fallback-http-server/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 optionMeaning
-d Debug verbosity in decimal, eg, -d15
-sConfigure 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 argshttp://127.0.0.1:7681https://127.0.0.1:7681ssh -p7681 127.0.0.1flags
noneservedno tlsechos helloLWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFIG
-sechos http GETservedechos helloLWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFIG, LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT
-s -hservedservedechos helloLWS_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 -uredirected to httpsservedechos helloLWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFIG, LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT, LWS_SERVER_OPTION_REDIRECT_HTTP_TO_HTTPS