aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-09-23 22:03:57 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-09-24 12:33:35 +0200
commit5a6f30440b66fe6713acb9d979dc3e6624e4c36a (patch)
tree9a4410f7f7ee7a37f4b28fc8963b3667c3a0a900 /include
parentf7864cb7d49a8ca5bddf8d1f68b71ecd5ed85adc (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 'include')
-rw-r--r--include/libweb/http.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/libweb/http.h b/include/libweb/http.h
index 736a561..f18b5c4 100644
--- a/include/libweb/http.h
+++ b/include/libweb/http.h
@@ -109,6 +109,7 @@ struct http_response
unsigned long long n;
size_t n_headers;
void (*free)(void *);
+ int (*step)(const struct http_payload *, struct http_response *, void *);
};
struct http_cfg