diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-10-06 16:27:21 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-10-06 16:27:21 +0200 |
| commit | 4918cf87d3cf5d3dd8425fe10d97a06282472df6 (patch) | |
| tree | d294a8c7af1ee441d5442d23d85a10166dea7516 | |
| parent | 3e4c7c993bbbe2bdeb563fa888b900d01c4be4a1 (diff) | |
libweb_http.7: Add note about HTTP responses
| -rw-r--r-- | doc/man7/libweb_http.7 | 35 |
1 files changed, 35 insertions, 0 deletions
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 |
