• Home
Name Date Size #Lines LOC

..--

CMakeLists.txtD12-May-20242 KiB8070

README.mdD12-May-20243.7 KiB7766

minimal-http-client.cD12-May-20247.8 KiB323234

selftest.shD12-May-2024831 3411

warmcat.com.cerD12-May-20243.5 KiB5958

README.md

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-v|Connection validity use 3s / 10s instead of default 5m / 5m10s
25--nossl| disable ssl connection
26--user <username>| Set Basic Auth username
27--password <password> | Set Basic Auth password
28
29```
30 $ ./lws-minimal-http-client
31[2018/03/04 14:43:20:8562] USER: LWS minimal http client
32[2018/03/04 14:43:20:8571] NOTICE: Creating Vhost 'default' port -1, 1 protocols, IPv6 on
33[2018/03/04 14:43:20:8616] NOTICE: created client ssl context for default
34[2018/03/04 14:43:20:8617] NOTICE: lws_client_connect_2: 0x1814dc0: address warmcat.com
35[2018/03/04 14:43:21:1496] NOTICE: lws_client_connect_2: 0x1814dc0: address warmcat.com
36[2018/03/04 14:43:22:0154] NOTICE: lws_client_interpret_server_handshake: incoming content length 26520
37[2018/03/04 14:43:22:0154] NOTICE: lws_client_interpret_server_handshake: client connection up
38[2018/03/04 14:43:22:0169] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
39[2018/03/04 14:43:22:0169] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
40[2018/03/04 14:43:22:0169] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
41[2018/03/04 14:43:22:0169] USER: RECEIVE_CLIENT_HTTP_READ: read 1015
42[2018/03/04 14:43:22:0174] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
43[2018/03/04 14:43:22:0174] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
44[2018/03/04 14:43:22:0174] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
45[2018/03/04 14:43:22:0174] USER: RECEIVE_CLIENT_HTTP_READ: read 1015
46[2018/03/04 14:43:22:0179] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
47[2018/03/04 14:43:22:0179] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
48[2018/03/04 14:43:22:0179] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
49[2018/03/04 14:43:22:0179] USER: RECEIVE_CLIENT_HTTP_READ: read 1015
50[2018/03/04 14:43:22:3010] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
51[2018/03/04 14:43:22:3010] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
52[2018/03/04 14:43:22:3010] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
53[2018/03/04 14:43:22:3010] USER: RECEIVE_CLIENT_HTTP_READ: read 1015
54[2018/03/04 14:43:22:3015] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
55[2018/03/04 14:43:22:3015] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
56[2018/03/04 14:43:22:3015] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
57[2018/03/04 14:43:22:3015] USER: RECEIVE_CLIENT_HTTP_READ: read 1015
58[2018/03/04 14:43:22:3020] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
59[2018/03/04 14:43:22:3020] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
60[2018/03/04 14:43:22:3020] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
61[2018/03/04 14:43:22:3020] USER: RECEIVE_CLIENT_HTTP_READ: read 1015
62[2018/03/04 14:43:22:3022] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
63[2018/03/04 14:43:22:3022] USER: RECEIVE_CLIENT_HTTP_READ: read 974
64[2018/03/04 14:43:22:3022] NOTICE: lws_http_client_read: transaction completed says -1
65[2018/03/04 14:43:23:3042] USER: Completed
66```
67
68You can also test the client Basic Auth support against the http-server/minimal-http-server-basicauth
69example.  In one console window run the server and in the other
70
71```
72$ lws-minimal-http-client -l --nossl --path /secret/index.html --user user --password password
73```
74
75The Basic Auth credentials for the test server are literally username "user" and password "password".
76
77