Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
91a707b
Import nghttp3 webtransport PR
martenrichter Jun 20, 2026
9ef189f
nghttp3: add wt to gyp
martenrichter Jun 20, 2026
524d75b
quic: Implement webtransport settings
martenrichter May 23, 2026
210fb35
quic: Implement webtransport response and reply
martenrichter May 24, 2026
9e2632e
quic: Improve webtransport options and lint
martenrichter May 25, 2026
b756bb3
quic: Make a webtransport stream
martenrichter May 30, 2026
0a5c07a
quic: Implement more webtransport stuff
martenrichter Jun 10, 2026
9bb8437
quic: Webtransport fix incoming streams
martenrichter Jun 13, 2026
56ba23a
quic: Webtransport remove debug code
martenrichter Jun 13, 2026
dbe73a2
quic: Do not try to open WT sending on remote unidirectional stream
martenrichter Jun 13, 2026
7ddf56f
quic: Remove debug code
martenrichter Jun 14, 2026
7acd811
quic: add session id callback to test
martenrichter Jun 20, 2026
0176ad6
quic: WT implement close session callback
martenrichter Jun 20, 2026
952eadf
quic: Remove debug message
martenrichter Jun 20, 2026
7f4c67d
quic: Fix wake up blob
martenrichter Jun 21, 2026
ddcbfb4
quic: Implement webtransport close session stream
martenrichter Jun 27, 2026
beec79e
quic: fixes in close webtransport session
martenrichter Jul 5, 2026
09d2e6e
quic: Add to close capsule
martenrichter Jul 7, 2026
f061a1c
quic: Fix CloseWebtransportSessionStream
martenrichter Jul 7, 2026
a93defd
quic: changes for nghttp3_conn_close_stream
martenrichter Jul 18, 2026
b41e452
quic: fix weakly weakup assignment
martenrichter Jul 18, 2026
36fb13e
quic: write desired size needs update on maxstream
martenrichter Jul 26, 2026
956e942
quic: fix fin handling, so it is broken
martenrichter Jul 26, 2026
22c2677
quic: test for establishing a wt session
martenrichter Aug 2, 2026
e8a061e
quic: remove stop sending as it breaks firefox and chromium
martenrichter Aug 2, 2026
868dd60
quic: Fix test
martenrichter Aug 2, 2026
30b8bbd
quic: Remove debug messages from test
martenrichter Aug 3, 2026
5fa5524
quic: Add test bidi echo from client
martenrichter Aug 3, 2026
1ba29d6
quic: Fix cpp linting
martenrichter Aug 3, 2026
b1c550f
quic: fix http3 callbacks
martenrichter Aug 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
321 changes: 314 additions & 7 deletions deps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,27 @@ typedef uint64_t nghttp3_duration;
* that might generating excessive load.
*/
#define NGHTTP3_ERR_H3_EXCESSIVE_LOAD -610
/**
* @macro
*
* :macro:`NGHTTP3_ERR_H3_MESSAGE_ERROR` indicates that HTTP message
* was malformed.
*/
#define NGHTTP3_ERR_H3_MESSAGE_ERROR -611
/**
* @macro
*
* :macro:`NGHTTP3_ERR_WT_SESSION_GONE` indicates that WebTransport
* session was terminated or rejected.
*/
#define NGHTTP3_ERR_WT_SESSION_GONE -612
/**
* @macro
*
* :macro:`NGHTTP3_ERR_WT_BUFFERED_STREAM_REJECTED` indicates that
* buffering WebTransport data stream was rejected.
*/
#define NGHTTP3_ERR_WT_BUFFERED_STREAM_REJECTED -613
/**
* @macro
*
Expand Down Expand Up @@ -503,6 +524,38 @@ typedef uint64_t nghttp3_duration;
* error code ``QPACK_DECODER_STREAM_ERROR``.
*/
#define NGHTTP3_QPACK_DECODER_STREAM_ERROR 0x0202
/**
* @macro
*
* :macro:`NGHTTP3_WT_BUFFERED_STREAM_REJECTED` is WebTransport error
* code ``WT_BUFFERED_STREAM_REJECTED``.
*/
#define NGHTTP3_WT_BUFFERED_STREAM_REJECTED 0x3994BD84
/**
* @macro
*
* :macro:`NGHTTP3_WT_SESSION_GONE` is WebTransport error code
* ``WT_SESSION_GONE``.
*/
#define NGHTTP3_WT_SESSION_GONE 0x170D7B68
/**
* @macro
*
* :macro:`NGHTTP3_WT_ALPN_ERROR` is WebTransport error code
* ``WT_ALPN_ERROR``.
*
* https://datatracker.ietf.org/doc/html/draft-ietf-webtrans-http3-15
*/
#define NGHTTP3_WT_ALPN_ERROR 0x0817B3DD
/**
* @macro
*
* :macro:`NGHTTP3_WT_REQUIREMENTS_NOT_MET` is WebTransport error code
* ``WT_REQUIREMENTS_NOT_MET``.
*
* https://datatracker.ietf.org/doc/html/draft-ietf-webtrans-http3-15
*/
#define NGHTTP3_WT_REQUIREMENTS_NOT_MET 0x212C0D48

/**
* @functypedef
Expand Down Expand Up @@ -1899,6 +1952,16 @@ typedef struct nghttp3_settings {
* .. version-added:: 1.13.0
*/
nghttp3_qpack_indexing_strat qpack_indexing_strat;
/**
* :member:`wt_enabled`, if set to nonzero, enables WebTransport.
*
* https://datatracker.ietf.org/doc/html/draft-ietf-webtrans-http3-15
*
* TODO For client, it might be better to always enable
* WebTransport. Only draft version of client needs to send
* SETTINGS_WT_ENABLED.
*/
uint8_t wt_enabled;
} nghttp3_settings;

#define NGHTTP3_PROTO_SETTINGS_V1 1
Expand Down Expand Up @@ -1939,6 +2002,12 @@ typedef struct nghttp3_proto_settings {
* Datagrams (see :rfc:`9297`).
*/
uint8_t h3_datagram;
/**
* :member:`wt_enabled`, if set to nonzero, enables WebTransport.
*
* https://datatracker.ietf.org/doc/html/draft-ietf-webtrans-http3-15
*/
uint8_t wt_enabled;
} nghttp3_proto_settings;

/**
Expand Down Expand Up @@ -2285,11 +2354,11 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
* invoked when a stream identified by |stream_id| is closed. If
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
* |flags|, |rx_app_error_code| is the QUIC application error code
* that shut down the receiving side of the stream. If
* received from the remote endpoint. If
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
* |flags|, |tx_app_error_code| is the QUIC application error code
* that shut down the sending side of the stream. No application code
* means that direction of stream is closed without any error.
* sent to the remote endpoint. No application code means that
* direction of stream is closed without any error.
*
* This callback should be used with `nghttp3_conn_close_stream2`. If
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
Expand All @@ -2312,6 +2381,69 @@ typedef int (*nghttp3_stream_close2)(nghttp3_conn *conn, uint32_t flags,
void *conn_user_data,
void *stream_user_data);

/**
* @functypedef
*
* :type:`nghttp3_recv_wt_data` is a callback function which is
* invoked when data is received on WebTransport data stream.
* |session_id| is the WebTransport session ID. |stream_id| is the
* stream ID of the WebTransport data stream. |data| points to the
* received data, and its length is |datalen|.
*
* The application is responsible for increasing flow control credit
* (say, increasing by |datalen| bytes).
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_recv_wt_data)(nghttp3_conn *conn, int64_t session_id,
int64_t stream_id, const uint8_t *data,
size_t datalen, void *conn_user_data,
void *stream_user_data);

/**
* @functypedef
*
* :type:`nghttp3_wt_data_stream_open` is a callback function which is
* invoked when a remote stream denoted by |stream_id| is identified
* as WebTransport data stream that belongs to WebTransport session
* identified by |session_id|. This callback function is called after
* WebTransport session is confirmed.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_wt_data_stream_open)(nghttp3_conn *conn,
int64_t session_id,
int64_t stream_id,
void *conn_user_data,
void *stream_user_data);

/**
* @functypedef
*
* :type:`nghttp3_recv_wt_close_session` is a callback function which
* is invoked when WT_CLOSE_SESSION Capsule is received. The
* WebTransport session is identified by |session_id|.
* |wt_error_code| is Application Error Code. The buffer pointed by
* |msg| of length |msglen| contains Application Error Message.
*
* The implementation of this callback must return 0 if it succeeds.
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
* caller immediately. Any values other than 0 is treated as
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
*/
typedef int (*nghttp3_recv_wt_close_session)(nghttp3_conn *conn,
int64_t session_id,
uint32_t wt_error_code,
const uint8_t *msg, size_t msglen,
void *conn_user_data,
void *stream_user_data);

#define NGHTTP3_CALLBACKS_V1 1
#define NGHTTP3_CALLBACKS_V2 2
#define NGHTTP3_CALLBACKS_V3 3
Expand Down Expand Up @@ -2462,6 +2594,22 @@ typedef struct nghttp3_callbacks {
* .. version-added:: 1.18.0
*/
nghttp3_stream_close2 stream_close2;
/**
* :member:`recv_wt_data` is a callback function which is invoked
* when data on WebTransport data stream is received.
*/
nghttp3_recv_wt_data recv_wt_data;
/**
* :member:`wt_data_stream_open` is a callback function which is
* invoked when a remote stream is identified as WebTransport data
* stream.
*/
nghttp3_wt_data_stream_open wt_data_stream_open;
/**
* :member:`recv_wt_close_session` is a callback function which is
* invoked when WT_CLOSE_SESSION Capsule is received.
*/
nghttp3_recv_wt_close_session recv_wt_close_session;
} nghttp3_callbacks;

/**
Expand Down Expand Up @@ -2938,11 +3086,11 @@ NGHTTP3_EXTERN int nghttp3_conn_close_stream(nghttp3_conn *conn,
* `nghttp3_conn_close_stream2` tells the library that a stream
* identified by |stream_id| has been closed. If
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
* |flags|, |rx_app_error_code| is the QUIC application error code
* that shut down the receiving side of the stream. Similarly,
* |flags|, |rx_app_error_code| is QUIC application error received
* from the remote endpoint. Similarly,
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
* |flags|, |tx_app_error_code| is the QUIC application error code
* that shut down the sending side of the stream.
* |flags|, |tx_app_error_code| is QUIC application error sent to the
* remote endpoint.
*
* For stream close callback, prefer
* :member:`nghttp3_callbacks.stream_close2` to
Expand Down Expand Up @@ -3476,6 +3624,165 @@ NGHTTP3_EXTERN int nghttp3_conn_is_drained(nghttp3_conn *conn);
*/
NGHTTP3_EXTERN int nghttp3_conn_is_drained2(const nghttp3_conn *conn);

/**
* @function
*
* `nghttp3_conn_submit_wt_request` works like
* `nghttp3_conn_submit_request`, but it is specifically tailored for
* WebTransport session establishment. |nva| of length |nvlen|
* specifies HTTP request header fields. They must contain at least
* the following fields:
*
* - :method = "CONNECT"
* - :scheme = "https"
* - :protocol = "webtransport-h3"
* - :authority
* - :path
*
* The application must also set the following settings:
*
* - :member:`nghttp3_settings.h3_datagram` = 1
* - :member:`nghttp3_settings.wt_enabled` = 1
*
* It also must send the following QUIC transport parameters:
*
* - max_datagram_frame_size > 0
* - reset_stream_at
*
* The application should wait for SETTINGS frame from server and make
* sure that it satisfies server-side requirements for WebTransport.
*
* After receiving 2xx response from server, WebTransport session is
* established. `nghttp3_conn_open_wt_data_stream` is used to open
* WebTransport data streams.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* TBD
*/
NGHTTP3_EXTERN int nghttp3_conn_submit_wt_request(nghttp3_conn *conn,
int64_t stream_id,
const nghttp3_nv *nva,
size_t nvlen,
void *stream_user_data);

/**
* @function
*
* `nghttp3_conn_submit_wt_response` works like
* `nghttp3_conn_submit_response`, but it is specifically tailored for
* WebTransport session establishment. |nva| of length |nvlen|
* specifies HTTP response header fields. It must contain 2xx status
* code in :status field.
*
* The application should make sure that the stream denoted by
* |stream_id| is a request stream that requests WebTransport session
* establishment. If this function is called inside
* :member:`nghttp3_callbacks.end_headers` callback,
* `nghttp3_conn_server_confirm_wt_session` is called internally, and
* it establishes WebTransport session. If this function is called
* outside of the callback, the application must call
* `nghttp3_conn_server_confirm_wt_session` after calling this
* function.
*
* If `nghttp3_conn_submit_response` is used against the WebTransport
* upgrade request, it means refusal of the request regardless of HTTP
* status code. The application is responsible to set non-2xx status
* code when `nghttp3_conn_submit_response` is used. If
* `nghttp3_conn_submit_response` is called from
* :member:`nghttp3_callbacks.end_headers` callback,
* :member:`nghttp3_callbacks.stop_sending` callback is automatically
* called. If `nghttp3_conn_submit_response` is called outside of the
* :member:`nghttp3_callbacks.end_headers` callback,
* :member:`nghttp3_callbacks.stop_sending` is not called
* automatically. The application should tell QUIC stack to send
* STOP_SENDING frame to this stream.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* TBD
*/
NGHTTP3_EXTERN int nghttp3_conn_submit_wt_response(nghttp3_conn *conn,
int64_t stream_id,
const nghttp3_nv *nva,
size_t nvlen);

/**
* @function
*
* `nghttp3_conn_server_confirm_wt_session` establishes WebTransport
* session. This should be called after
* `nghttp3_conn_submit_wt_response` call if it is not called inside
* `nghttp3_callbacks.end_headers` callback.
*
* Only server can call this function.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* TBD
*/
NGHTTP3_EXTERN int nghttp3_conn_server_confirm_wt_session(nghttp3_conn *conn,
int64_t session_id,
nghttp3_tstamp ts);

/**
* @function
*
* `nghttp3_conn_open_wt_data_stream` opens WebTransport data stream.
* |session_id| is the stream ID that established WebTransport
* session. |stream_id| is the stream ID to write data, and it can be
* both bidirectional and unidirectional. |dr| must not be NULL, and
* it must have non-NULL callback.
*
* This function can be also used to start writing to the
* bidirectional stream initiated by the remote endpoint.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* TBD
*/
NGHTTP3_EXTERN int nghttp3_conn_open_wt_data_stream(
nghttp3_conn *conn, int64_t session_id, int64_t stream_id,
const nghttp3_data_reader *dr, void *stream_user_data);

/**
* @function
*
* `nghttp3_conn_close_wt_session` closes WebTransport session denoted
* by |session_id| which is the stream ID that established
* WebTransport session. |wt_error_code| is WebTransport error code.
* Upon calling this function, all existing WebTransport data streams
* are shutdown. |msg| of |msglen| bytes is the application error
* message, which is optional. |msglen| must be less than or equal to
* 1024.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* TBD
*/
NGHTTP3_EXTERN int nghttp3_conn_close_wt_session(nghttp3_conn *conn,
int64_t session_id,
uint32_t wt_error_code,
const uint8_t *msg,
size_t msglen);

/**
* @function
*
* `nghttp3_conn_get_stream_wt_session_id` returns the WebTransport
* session ID of a stream denoted by |stream_id| if it is WebTransport
* data stream. If the stream is not found, it is not a WebTransport
* data stream, or it is unable to get session ID, this function
* returns -1.
*/
NGHTTP3_EXTERN int64_t nghttp3_conn_get_stream_wt_session_id(
const nghttp3_conn *conn, int64_t stream_id);

/**
* @function
*
Expand Down
2 changes: 1 addition & 1 deletion deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* Version number of the nghttp3 library release.
*/
#define NGHTTP3_VERSION "1.18.0"
#define NGHTTP3_VERSION "1.18.0-DEV"

/**
* @macro
Expand Down
Loading
Loading