1*1c60b9acSAndroid Build Coastguard Worker# lws minimal raw fallback http server 2*1c60b9acSAndroid Build Coastguard Worker 3*1c60b9acSAndroid Build Coastguard WorkerThis is the same as the minimal http server, with one difference... 4*1c60b9acSAndroid Build Coastguard Workerif you connect to localhost:7681 with something that doesn't send 5*1c60b9acSAndroid Build Coastguard Workerrecognizable http, then the connection will be switched to a 6*1c60b9acSAndroid Build Coastguard Workerraw-skt role and bind to a protocol that echoes anything sent back 7*1c60b9acSAndroid Build Coastguard Workerto the sender. 8*1c60b9acSAndroid Build Coastguard Worker 9*1c60b9acSAndroid Build Coastguard Worker## build 10*1c60b9acSAndroid Build Coastguard Worker 11*1c60b9acSAndroid Build Coastguard Worker``` 12*1c60b9acSAndroid Build Coastguard Worker $ cmake . && make 13*1c60b9acSAndroid Build Coastguard Worker``` 14*1c60b9acSAndroid Build Coastguard Worker 15*1c60b9acSAndroid Build Coastguard Worker## usage 16*1c60b9acSAndroid Build Coastguard Worker 17*1c60b9acSAndroid Build Coastguard WorkerCommandline option|Meaning 18*1c60b9acSAndroid Build Coastguard Worker---|--- 19*1c60b9acSAndroid Build Coastguard Worker-d <loglevel>|Debug verbosity in decimal, eg, -d15 20*1c60b9acSAndroid Build Coastguard Worker-s|Configure the server for tls / https and `LWS_SERVER_OPTION_ALLOW_NON_SSL_ON_SSL_PORT` 21*1c60b9acSAndroid Build Coastguard Worker-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) 22*1c60b9acSAndroid Build Coastguard Worker-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. 23*1c60b9acSAndroid Build Coastguard Worker 24*1c60b9acSAndroid Build Coastguard Worker``` 25*1c60b9acSAndroid Build Coastguard Worker $ ./lws-minimal-raw-fallback-http-server 26*1c60b9acSAndroid Build Coastguard Worker[2018/11/29 14:27:34:3014] USER: LWS minimal raw fallback http server | visit http://localhost:7681 27*1c60b9acSAndroid Build Coastguard Worker[2018/11/29 14:27:34:3243] NOTICE: Creating Vhost 'default' port 7681, 1 protocols, IPv6 off 28*1c60b9acSAndroid Build Coastguard Worker``` 29*1c60b9acSAndroid Build Coastguard Worker 30*1c60b9acSAndroid Build Coastguard WorkerVisit http://127.0.0.1:7681 31*1c60b9acSAndroid Build Coastguard Worker 32*1c60b9acSAndroid Build Coastguard WorkerThis allows testing of various combinations of special features for unexpected 33*1c60b9acSAndroid Build Coastguard Workercontent on an http(s) listening socket. 34*1c60b9acSAndroid Build Coastguard Worker 35*1c60b9acSAndroid Build Coastguard Worker|cmdline args|http://127.0.0.1:7681|https://127.0.0.1:7681|ssh -p7681 127.0.0.1|flags| 36*1c60b9acSAndroid Build Coastguard Worker|---|---|---|---|---| 37*1c60b9acSAndroid Build Coastguard Worker|none|served|no tls|echos hello|LWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFIG 38*1c60b9acSAndroid Build Coastguard Worker|-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 39*1c60b9acSAndroid Build Coastguard Worker|-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 40*1c60b9acSAndroid Build Coastguard Worker|-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 41*1c60b9acSAndroid Build Coastguard Worker 42