# lws minimal http client POST This example demonstrates a multipart POST to https://libwebsockets.org/testserver/formtest setting both a form variable and uploading a short file. The result of the POST form processing is captured and displayed in a hexdump. This is programmatically POSTing to the same form you can access at https://libwebsockets.org/testserver in the "POST" tab with file upload. By default the client action occurs using http/2 if your lws was built with `-DLWS_WITH_HTTP2=1`. ## build ``` $ cmake . && make ``` ## usage ``` $ ./lws-minimal-http-client-post [2018/04/03 13:13:10:7891] USER: LWS minimal http client - POST [2018/04/03 13:13:10:7905] NOTICE: Creating Vhost 'default' (serving disabled), 1 protocols, IPv6 on [2018/04/03 13:13:10:7984] NOTICE: created client ssl context for default [2018/04/03 13:13:12:8444] USER: LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER [2018/04/03 13:13:12:8444] USER: LWS_CALLBACK_CLIENT_HTTP_WRITEABLE [2018/04/03 13:13:12:8445] USER: LWS_CALLBACK_CLIENT_HTTP_WRITEABLE [2018/04/03 13:13:12:8445] USER: LWS_CALLBACK_CLIENT_HTTP_WRITEABLE [2018/04/03 13:13:13:1437] USER: LWS_CALLBACK_CLIENT_HTTP_WRITEABLE [2018/04/03 13:13:13:1440] USER: LWS_CALLBACK_CLIENT_HTTP_WRITEABLE [2018/04/03 13:13:13:1440] USER: RECEIVE_CLIENT_HTTP_READ: read 402 [2018/04/03 13:13:13:1441] NOTICE: [2018/04/03 13:13:13:1441] NOTICE: 0000: 3C 68 74 6D 6C 3E 3C 62 6F 64 79 3E 3C 68 31 3E
Name | Length | [2018/04/03 13:13:13:1441] NOTICE: 0060: 56 61 6C 75 65 3C 2F 74 64 3E 3C 2F 74 72 3E 3C Value | text [2018/04/03 13:13:13:1441] NOTICE: 0080: 62 3E 3C 2F 74 64 3E 3C 74 64 3E 31 33 3C 2F 74 b> | 13 | my text fi [2018/04/03 13:13:13:1441] NOTICE: 00A0: 65 6C 64 3C 2F 74 64 3E 3C 2F 74 72 3E 3C 74 72 eld |
send [2018/04/03 13:13:13:1441] NOTICE: 00C0: 3C 2F 74 64 3E 3C 74 64 3E 30 3C 2F 74 64 3E 3C | 0 | < [2018/04/03 13:13:13:1442] NOTICE: 00D0: 74 64 3E 4E 55 4C 4C 3C 2F 74 64 3E 3C 2F 74 72 td>NULL|
file [2018/04/03 13:13:13:1442] NOTICE: 00F0: 3C 2F 62 3E 3C 2F 74 64 3E 3C 74 64 3E 30 3C 2F | 0 [2018/04/03 13:13:13:1442] NOTICE: 0100: 74 64 3E 3C 74 64 3E 4E 55 4C 4C 3C 2F 74 64 3E td> | NULL | [2018/04/03 13:13:13:1442] NOTICE: 0110: 3C 2F 74 72 3E 3C 74 72 3E 3C 74 64 3E 3C 62 3E
[2018/04/03 13:13:13:1442] NOTICE: 0120: 75 70 6C 6F 61 64 3C 2F 62 3E 3C 2F 74 64 3E 3C upload | < [2018/04/03 13:13:13:1442] NOTICE: 0130: 74 64 3E 30 3C 2F 74 64 3E 3C 74 64 3E 4E 55 4C td>0NUL [2018/04/03 13:13:13:1442] NOTICE: 0140: 4C 3C 2F 74 64 3E 3C 2F 74 72 3E 3C 2F 74 61 62 L |