|
wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
|
One request/response exchange handed to a wired_http_handler. More...
#include <srvrun.h>
Data Fields | |
| const wired_h3reqdrive_req * | req |
| the decoded request; its views are not valid past the call | |
| u64 | offset |
| response body bytes already delivered by prior rounds | |
| wired_obuf * | body |
| receives this round's response body bytes (see wired_srvloop_handler) | |
| u16 | status |
| response status; 0 means 200 (first round only) | |
| const char * | content_type |
| static NUL-terminated content-type, or 0 to omit (first round only) | |
| wired_http_field | fields [WIRED_HTTP_MAX_FIELDS] |
| extra response header fields, in order (first round only) | |
| usz | field_count |
| entries used in fields | |
| int | more |
| set to 1 to request another round (see wired_srvloop_handler) | |
| u64 | total_size |
| full body length if known, first round only (see wired_srvloop_handler) | |
One request/response exchange handed to a wired_http_handler.
The caller zeroes every out-member before each call, so a handler that sets nothing answers a body-less 200, exactly like a 7-argument handler.
Validated after the first round (offset == 0); any violation answers 500 with no fields and no body instead: status in 100-199 (101 included), below 100 or above 599; field_count above WIRED_HTTP_MAX_FIELDS (a 9th field is rejected, never silently dropped); a field name that is not a token (RFC 9110 5.1: empty, SP, ':', CTL or non-ASCII), carries an uppercase letter, or names a connection-specific field (RFC 9114 4.2); CR, LF or NUL in a value or CR/LF in content_type (RFC 9110 5.5); more than WIRED_HTTP_FIELD_BYTES_MAX name+value+content_type bytes in total. 204 and 304 never carry content (RFC 9110 15.3.5 / 15.4.5): the body is dropped and HEADERS ends the stream.