README.md
1# lws minimal http client custom headers
2
3This http client application shows how to send and receive custom headers.
4
5This currently only works on http 1, so the app forces that even if h2 enables.
6
7## build
8
9```
10 $ cmake . && make
11```
12
13## usage
14
15Commandline option|Meaning
16---|---
17-d <loglevel>|Debug verbosity in decimal, eg, -d15
18-l| Connect to https://localhost:7681 and accept selfsigned cert
19-n|no TLS
20
21The app looks for a custom header "test-custom-header" sent by warmcat.com.
22
23```
24 $ ./lws-minimal-http-client-custom-headers
25[2019/03/11 05:46:45:7582] USER: LWS minimal http client Custom Headers [-d<verbosity>] [-l] [--h1]
26[2019/03/11 05:46:45:7671] NOTICE: created client ssl context for default
27[2019/03/11 05:46:46:7812] USER: Connected with server response: 200
28[2019/03/11 05:46:46:7812] NOTICE: callback_http: custom header: 'hello'
29[2019/03/11 05:46:46:7814] USER: RECEIVE_CLIENT_HTTP_READ: read 1024
30...
31```
32You can use the -n and -l to make this test app connect to localhost:7681 over http,
33and confirm the "dnt:1" header was sent either by tcpdump or by running the test
34server on :7681 with -d1151
35
36```
37[2019/03/11 05:48:53:6806] PARSER: WSI_TOKEN_NAME_PART 'd' 0x64 (role=0x20000000) wsi->lextable_pos=0
38[2019/03/11 05:48:53:6807] PARSER: WSI_TOKEN_NAME_PART 'n' 0x6E (role=0x20000000) wsi->lextable_pos=567
39[2019/03/11 05:48:53:6807] PARSER: WSI_TOKEN_NAME_PART 't' 0x74 (role=0x20000000) wsi->lextable_pos=-1
40[2019/03/11 05:48:53:6807] PARSER: WSI_TOKEN_NAME_PART ' ' 0x20 (role=0x20000000) wsi->lextable_pos=-1
41[2019/03/11 05:48:53:6807] PARSER: WSI_TOKEN_NAME_PART '1' 0x31 (role=0x20000000) wsi->lextable_pos=-1
42' 0x0D (role=0x20000000) wsi->lextable_pos=-1NAME_PART '
43[2019/03/11 05:48:53:6807] PARSER: WSI_TOKEN_NAME_PART '
44```
45
46