1# lws minimal http client 2 3The application goes to either https://warmcat.com or 4https://localhost:7681 (with `-l` option) and receives the page data. 5 6## build 7 8``` 9 $ cmake . && make 10``` 11 12## usage 13 14Commandline option|Meaning 15---|--- 16-d <loglevel>|Debug verbosity in decimal, eg, -d15 17-l| Connect to https://localhost:7681 and accept selfsigned cert 18--h1|Specify http/1.1 only using ALPN, rejects h2 even if server supports it 19--server <name>|set server name to connect to 20-k|Apply tls option LCCSCF_ALLOW_INSECURE 21-j|Apply tls option LCCSCF_ALLOW_SELFSIGNED 22-m|Apply tls option LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK 23-e|Apply tls option LCCSCF_ALLOW_EXPIRED 24-b|Apply tls option LCCSCF_CACHE_COOKIES 25-w|For mbedtls/wolfssl, load wrong CA cert (expected to fail) 26-c <cookie jar file>|Set filepath used for cookie jar 27-v|Connection validity use 3s / 10s instead of default 5m / 5m10s 28--nossl| disable ssl connection 29--user <username>| Set Basic Auth username 30--password <password> | Set Basic Auth password 31 32``` 33 $ ./lws-minimal-http-client 34[2018/03/04 14:43:20:8562] USER: LWS minimal http client 35[2018/03/04 14:43:20:8571] NOTICE: Creating Vhost 'default' port -1, 1 protocols, IPv6 on 36[2018/03/04 14:43:20:8616] NOTICE: created client ssl context for default 37[2018/03/04 14:43:20:8617] NOTICE: lws_client_connect_2: 0x1814dc0: address warmcat.com 38[2018/03/04 14:43:21:1496] NOTICE: lws_client_connect_2: 0x1814dc0: address warmcat.com 39[2018/03/04 14:43:22:0154] NOTICE: lws_client_interpret_server_handshake: incoming content length 26520 40[2018/03/04 14:43:22:0154] NOTICE: lws_client_interpret_server_handshake: client connection up 41[2018/03/04 14:43:22:0169] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 42[2018/03/04 14:43:22:0169] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 43[2018/03/04 14:43:22:0169] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 44[2018/03/04 14:43:22:0169] USER: RECEIVE_CLIENT_HTTP_READ: read 1015 45[2018/03/04 14:43:22:0174] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 46[2018/03/04 14:43:22:0174] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 47[2018/03/04 14:43:22:0174] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 48[2018/03/04 14:43:22:0174] USER: RECEIVE_CLIENT_HTTP_READ: read 1015 49[2018/03/04 14:43:22:0179] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 50[2018/03/04 14:43:22:0179] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 51[2018/03/04 14:43:22:0179] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 52[2018/03/04 14:43:22:0179] USER: RECEIVE_CLIENT_HTTP_READ: read 1015 53[2018/03/04 14:43:22:3010] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 54[2018/03/04 14:43:22:3010] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 55[2018/03/04 14:43:22:3010] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 56[2018/03/04 14:43:22:3010] USER: RECEIVE_CLIENT_HTTP_READ: read 1015 57[2018/03/04 14:43:22:3015] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 58[2018/03/04 14:43:22:3015] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 59[2018/03/04 14:43:22:3015] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 60[2018/03/04 14:43:22:3015] USER: RECEIVE_CLIENT_HTTP_READ: read 1015 61[2018/03/04 14:43:22:3020] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 62[2018/03/04 14:43:22:3020] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 63[2018/03/04 14:43:22:3020] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 64[2018/03/04 14:43:22:3020] USER: RECEIVE_CLIENT_HTTP_READ: read 1015 65[2018/03/04 14:43:22:3022] USER: RECEIVE_CLIENT_HTTP_READ: read 1024 66[2018/03/04 14:43:22:3022] USER: RECEIVE_CLIENT_HTTP_READ: read 974 67[2018/03/04 14:43:22:3022] NOTICE: lws_http_client_read: transaction completed says -1 68[2018/03/04 14:43:23:3042] USER: Completed 69``` 70 71You can also test the client Basic Auth support against the http-server/minimal-http-server-basicauth 72example. In one console window run the server and in the other 73 74``` 75$ lws-minimal-http-client -l --nossl --path /secret/index.html --user user --password password 76``` 77 78The Basic Auth credentials for the test server are literally username "user" and password "password". 79 80