|
wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
|
RFC 9114 4.1 / 4.3.1, RFC 9204 4.5: drive HTTP/3 requests end to end: QPACK-encode and frame outgoing GET or arbitrary-method requests, and recover the pseudo-headers of received ones. More...
#include "app/http3/core/h3/priority.h"#include "app/qpack/qpack/dyntable.h"#include "common/bytes/span/span.h"#include "common/platform/sys/syscall.h"Go to the source code of this file.
Data Structures | |
| struct | wired_h3reqdrive_get_in |
| The :path and :authority values for a GET request. More... | |
| struct | wired_h3reqdrive_send_in |
| Remaining arguments of wired_h3reqdrive_send_method beyond stream_id/out: the request line (method/path/authority) and the optional body. More... | |
| struct | wired_h3reqdrive_hdr |
| One regular request header: name and value as octet positions inside the request's hdr_base (its decode scratch), so a copy of the request only has to move the bytes and re-point hdr_base. More... | |
| struct | wired_h3reqdrive_req |
| RFC 9114 4.1 / 4.3.1, RFC 9204 4.5: recovered request pseudo-headers. More... | |
Macros | |
| #define | WIRED_H3REQDRIVE_MAX_HDRS 32 |
| Regular request headers kept per request (see wired_h3reqdrive_req's hdrs); further ones are ignored. | |
Functions | |
| int | wired_h3reqdrive_send_get (u64 stream_id, const wired_h3reqdrive_get_in *in, wired_obuf *out) |
| RFC 9114 4.1 / 4.3.1, RFC 9204 4.5: drive an HTTP/3 GET request end to end: QPACK-encode the request pseudo-headers (h3reqenc), wrap them in a HEADERS frame and a QUIC STREAM frame (h3conn). | |
| int | wired_h3reqdrive_send_method (u64 stream_id, const wired_h3reqdrive_send_in *in, wired_obuf *out) |
| RFC 9114 4.1 / 4.3.1, RFC 9204 4.5: drive an arbitrary-method HTTP/3 request end to end: QPACK-encode the request pseudo-headers with the given :method, append a DATA frame when in->body is non-empty, and wrap in a STREAM frame. | |
| static wired_span | wired_h3req_path (const wired_h3reqdrive_req *r) |
| The request's :path as one view (path, path_len). | |
| int | wired_http_req_header (const wired_h3reqdrive_req *req, wired_span name, wired_span *out) |
| RFC 9114 4.2: find a regular request header by name. | |
| int | wired_h3reqdrive_recv_get (wired_span stream_data, wired_mspan scratch, wired_h3reqdrive_req *r) |
| RFC 9114 4.1, RFC 9204 4.5: decode a STREAM frame carrying a request: recover :method, :scheme, :authority and :path from the leading HEADERS frame's QPACK field section. | |
| int | wired_h3reqdrive_recv_get_dyn (wired_span stream_data, wired_mspan scratch, const qpack_dyn *dyn, wired_h3reqdrive_req *r) |
| Same as wired_h3reqdrive_recv_get, but also resolves dynamic-table references (RFC 9204 4.5.2/4.5.3 Indexed Field Line / Indexed Field Line with Post-Base Index) against dyn – the connection's QPACK dynamic table (0 behaves exactly like wired_h3reqdrive_recv_get: every dynamic reference then simply fails to resolve). | |
RFC 9114 4.1 / 4.3.1, RFC 9204 4.5: drive HTTP/3 requests end to end: QPACK-encode and frame outgoing GET or arbitrary-method requests, and recover the pseudo-headers of received ones.
|
inlinestatic |
The request's :path as one view (path, path_len).
| r | decoded request |
| int wired_h3reqdrive_recv_get | ( | wired_span | stream_data, |
| wired_mspan | scratch, | ||
| wired_h3reqdrive_req * | r ) |
RFC 9114 4.1, RFC 9204 4.5: decode a STREAM frame carrying a request: recover :method, :scheme, :authority and :path from the leading HEADERS frame's QPACK field section.
Literal values are copied into scratch. A trailing DATA frame (POST/PUT/PATCH body) is viewed in place via r->body / r->body_len; bodyless requests leave body_len 0.
| stream_data | the STREAM frame payload carrying the request |
| scratch | caller-supplied buffer backing r's literal values; the caller keeps it alive while r is in use |
| r | receives the recovered pseudo-headers and body view |
| int wired_h3reqdrive_recv_get_dyn | ( | wired_span | stream_data, |
| wired_mspan | scratch, | ||
| const qpack_dyn * | dyn, | ||
| wired_h3reqdrive_req * | r ) |
Same as wired_h3reqdrive_recv_get, but also resolves dynamic-table references (RFC 9204 4.5.2/4.5.3 Indexed Field Line / Indexed Field Line with Post-Base Index) against dyn – the connection's QPACK dynamic table (0 behaves exactly like wired_h3reqdrive_recv_get: every dynamic reference then simply fails to resolve).
| stream_data | the STREAM frame payload carrying the request |
| scratch | caller-supplied buffer backing r's literal values; the caller keeps it alive while r is in use |
| dyn | the connection's dynamic table, or 0 if none is tracked |
| r | receives the recovered pseudo-headers and body view |
| int wired_h3reqdrive_send_get | ( | u64 | stream_id, |
| const wired_h3reqdrive_get_in * | in, | ||
| wired_obuf * | out ) |
RFC 9114 4.1 / 4.3.1, RFC 9204 4.5: drive an HTTP/3 GET request end to end: QPACK-encode the request pseudo-headers (h3reqenc), wrap them in a HEADERS frame and a QUIC STREAM frame (h3conn).
| stream_id | the request stream id to write in the STREAM frame |
| in | the :path and :authority values |
| out | receives the encoded STREAM frame |
| int wired_h3reqdrive_send_method | ( | u64 | stream_id, |
| const wired_h3reqdrive_send_in * | in, | ||
| wired_obuf * | out ) |
RFC 9114 4.1 / 4.3.1, RFC 9204 4.5: drive an arbitrary-method HTTP/3 request end to end: QPACK-encode the request pseudo-headers with the given :method, append a DATA frame when in->body is non-empty, and wrap in a STREAM frame.
| stream_id | the request stream id to write in the STREAM frame |
| in | the request line (method/path/authority) and the optional body |
| out | receives the encoded STREAM frame |
| int wired_http_req_header | ( | const wired_h3reqdrive_req * | req, |
| wired_span | name, | ||
| wired_span * | out ) |
RFC 9114 4.2: find a regular request header by name.
Field names are lowercase on the wire, so the match is exact (case-sensitive). cookie returns the crumbs joined with "; " (RFC 9114 4.2.1); other duplicates return the first. Only the first WIRED_H3REQDRIVE_MAX_HDRS other regular headers are searched.
| req | the decoded request |
| name | the lowercase field name |
| out | receives a view of the value, valid as long as req's views |