From 4918cf87d3cf5d3dd8425fe10d97a06282472df6 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 6 Oct 2025 16:27:21 +0200 Subject: libweb_http.7: Add note about HTTP responses --- doc/man7/libweb_http.7 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/doc/man7/libweb_http.7 b/doc/man7/libweb_http.7 index a8e315d..63a68da 100644 --- a/doc/man7/libweb_http.7 +++ b/doc/man7/libweb_http.7 @@ -726,6 +726,41 @@ instance. In this case, must be assigned to a function to be later called by .IR libweb . +Functions must assign +.B all unused members +in a +.I struct http_response +instance to +.I 0 +or +.IR NULL . +Otherwise, +.BR "the behaviour is undefined" . +For example, the following assignment sets three members, +namely +.IR status, +.I buf.ro +and +.IR n , +while leaving all unused members to +.I 0 +or +.IR NULL : + +.PP +.in +4n +.EX +static const char body[] = "Hi there!\en"; +*r = (const struct http_response) +{ + .status = HTTP_STATUS_OK, + .buf.ro = body, + .n = sizeof body - 1 +}; +.EE +.in +.PP + .SS Transport Layer Security (TLS) By design, .I libweb -- cgit v1.2.3