1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/minimal-examples/http-client/minimal-http-client-h2-rxflow
Andy Green b3131fdfdd cmakelist: Augean Stables refactor
Establish a new distributed CMake architecture with CMake code related to
a source directory moving to be in the subdir in its own CMakeLists.txt.
In particular, there's now one in ./lib which calls through to ones
further down the directory tree like ./lib/plat/xxx, ./lib/roles/xxx etc.

This cuts the main CMakelists.txt from 98KB -> 33KB, about a 66% reduction,
and it's much easier to maintain sub-CMakeLists.txt that are in the same
directory as the sources they manage, and conceal all the details that that
level.

Child CMakelists.txt become responsible for:

 - include_directories() definition (this is not supported by CMake
   directly, it passes it back up via PARENT_SCOPE vars in helper
   macros)

 - Addition child CMakeLists.txt inclusion, for example toplevel ->
   role -> role subdir

 - Source file addition to the build

 - Dependent library path resolution... this is now a private thing
   in the child CMakeLists.txt, it just passes back any adaptations
   to include_directories() and the LIB_LIST without filling the
   parent namespace with the details
2020-05-27 08:40:12 +01:00
..
CMakeLists.txt cmakelist: Augean Stables refactor 2020-05-27 08:40:12 +01:00
minimal-http-client.c client: allow setting overall connect timeout from vh init 2020-05-26 17:05:39 +01:00
README.md h2: LCCSCF_H2_MANUAL_RXFLOW and refactor txcr 2020-01-02 08:31:02 +00:00
warmcat.com.cer h2: LCCSCF_H2_MANUAL_RXFLOW and refactor txcr 2020-01-02 08:31:02 +00:00

lws minimal http client-h2-rxflow

The application reads from a server with tightly controlled and rate-limited receive flow control using h2 tx credit.

build

 $ cmake . && make

usage

Commandline option Meaning
-d Debug verbosity in decimal, eg, -d15
-l Connect to https://localhost:7681 and accept selfsigned cert
--server set server name to connect to
--path URL path to access on server
-k Apply tls option LCCSCF_ALLOW_INSECURE
-j Apply tls option LCCSCF_ALLOW_SELFSIGNED
-m Apply tls option LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK
-e Apply tls option LCCSCF_ALLOW_EXPIRED
-v Connection validity use 3s / 10s instead of default 5m / 5m10s
--nossl disable ssl connection
-f Indicate we will manually manage tx credit and set a new connection-specific initial tx credit

RX is constrained to 1024 bytes every 250ms

 $ ./lws-minimal-http-client-h2-rxflow  --server phys.org --path "/" -f 1024
[2019/12/26 13:32:59:6801] U: LWS minimal http client [-d<verbosity>] [-l] [--h1]
[2019/12/26 13:33:00:5087] N: system_notify_cb: manual peer tx credit 1024
[2019/12/26 13:33:01:7390] U: Connected to 72.251.236.55, http response: 200
[2019/12/26 13:33:01:7441] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:01:0855] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:02:3367] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:02:5858] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:02:8384] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:02:0886] U: RECEIVE_CLIENT_HTTP_READ: read 1024
...
[2019/12/26 13:33:46:1152] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:47:3650] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:47:6150] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:47:8666] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:47:1154] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:48:3656] U: RECEIVE_CLIENT_HTTP_READ: read 1024
[2019/12/26 13:33:48:6157] U: RECEIVE_CLIENT_HTTP_READ: read 380
[2019/12/26 13:33:48:6219] U: LWS_CALLBACK_COMPLETED_CLIENT_HTTP
[2019/12/26 13:33:48:7050] U: Completed: OK