diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-09-23 22:03:57 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-09-24 12:33:35 +0200 |
| commit | 5a6f30440b66fe6713acb9d979dc3e6624e4c36a (patch) | |
| tree | 9a4410f7f7ee7a37f4b28fc8963b3667c3a0a900 /doc | |
| parent | f7864cb7d49a8ca5bddf8d1f68b71ecd5ed85adc (diff) | |
Implement async HTTP responses
Sometimes, library users cannot return a HTTP response as soon as the
request is received, or the operations that are required to generate it
can take a long time.
In order to solve this, libweb adds a new member to struct
http_response, namely step, which must be assigned to a function
whenever a HTTP response should be generated in a non-blocking manner.
Leaving the function pointer as null will fall back to the default
behaviour.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/man7/libweb_http.7 | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/man7/libweb_http.7 b/doc/man7/libweb_http.7 index f11c1ef..c3bec8b 100644 --- a/doc/man7/libweb_http.7 +++ b/doc/man7/libweb_http.7 @@ -562,6 +562,7 @@ struct http_response unsigned long long \fIn\fP; size_t \fIn_headers\fP; void (*\fIfree\fP)(void *); + int (*\fIstep\fP)(const struct http_payload *, struct http_response *, void *); }; .EE .in @@ -669,6 +670,24 @@ is a valid pointer. Otherwise, .I free must be a null pointer. +.I step +allows implementations to generate a response in a non-blocking manner. +When a response is not immediately available when a payload is received, +.I step +must be assigned to a function that can generate it later. +.I libweb +shall then call this function immediately later, +without blocking other clients. +Assigning +.I step +to a null pointer falls back to the default behaviour +i.e., a response is returned immediately. +Note that a non-null +.I step +shall always take priority, thus ignoring any other information inside the +.I "struct http_response" +instance. + .SS Transport Layer Security (TLS) By design, .I libweb |
