wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
Loading...
Searching...
No Matches
request_drive.h File Reference

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_req
 RFC 9114 4.1 / 4.3.1, RFC 9204 4.5: recovered request pseudo-headers. More...

Functions

int wired_h3reqdrive_send_get (u64 stream_id, const wired_h3reqdrive_get_in *in, quic_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, quic_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.
int wired_h3reqdrive_recv_get (quic_span stream_data, quic_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 (quic_span stream_data, quic_mspan scratch, const quic_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).
int wired_h3reqdrive_trailer_ok (quic_span stream_data, quic_mspan scratch)
 RFC 9114 4.3: check that a request stream's trailer section (if any) carries no pseudo-header field – a pseudo-header is only valid in the leading field section.

Detailed Description

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.

Function Documentation

◆ wired_h3reqdrive_recv_get()

int wired_h3reqdrive_recv_get ( quic_span stream_data,
quic_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.

Parameters
stream_datathe STREAM frame payload carrying the request
scratchcaller-supplied buffer backing r's literal values; the caller keeps it alive while r is in use
rreceives the recovered pseudo-headers and body view
Returns
1 on success, 0 on a malformed frame or field section.

◆ wired_h3reqdrive_recv_get_dyn()

int wired_h3reqdrive_recv_get_dyn ( quic_span stream_data,
quic_mspan scratch,
const quic_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).

Parameters
stream_datathe STREAM frame payload carrying the request
scratchcaller-supplied buffer backing r's literal values; the caller keeps it alive while r is in use
dynthe connection's dynamic table, or 0 if none is tracked
rreceives the recovered pseudo-headers and body view
Returns
1 on success, 0 on a malformed frame, field section, or an unresolvable/invalid dynamic-table reference (RFC 9204 4.5.1.2).

◆ wired_h3reqdrive_send_get()

int wired_h3reqdrive_send_get ( u64 stream_id,
const wired_h3reqdrive_get_in * in,
quic_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).

Parameters
stream_idthe request stream id to write in the STREAM frame
inthe :path and :authority values
outreceives the encoded STREAM frame
Returns
1 with out->len set, 0 on overflow.

◆ wired_h3reqdrive_send_method()

int wired_h3reqdrive_send_method ( u64 stream_id,
const wired_h3reqdrive_send_in * in,
quic_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.

Parameters
stream_idthe request stream id to write in the STREAM frame
inthe request line (method/path/authority) and the optional body
outreceives the encoded STREAM frame
Returns
1 with out->len set, 0 on overflow.

◆ wired_h3reqdrive_trailer_ok()

int wired_h3reqdrive_trailer_ok ( quic_span stream_data,
quic_mspan scratch )

RFC 9114 4.3: check that a request stream's trailer section (if any) carries no pseudo-header field – a pseudo-header is only valid in the leading field section.

Vacuously ok when there is no trailer.

Parameters
stream_datathe STREAM frame payload carrying the request
scratchcaller-supplied scratch backing the trailer's literal values during the walk (discarded once this call returns)
Returns
1 if there is no trailer or it is free of pseudo-headers, 0 if the trailer is malformed or carries a pseudo-header.