@@ -1749,7 +1749,11 @@ typedef struct nghttp3_conn nghttp3_conn;
17491749typedef struct nghttp3_settings {
17501750 /**
17511751 * :member:`max_field_section_size` specifies the maximum header
1752- * section (block) size.
1752+ * section (block) size. nghttp3 library does not enforce this
1753+ * limit. Applications are responsible for imposing their own
1754+ * limits to protect against resource exhaustion. See
1755+ * https://datatracker.ietf.org/doc/html/rfc9114#section-4.2.2 for
1756+ * details.
17531757 */
17541758 uint64_t max_field_section_size ;
17551759 /**
@@ -1828,6 +1832,44 @@ typedef struct nghttp3_settings {
18281832 nghttp3_qpack_indexing_strat qpack_indexing_strat ;
18291833} nghttp3_settings ;
18301834
1835+ #define NGHTTP3_PROTO_SETTINGS_V1 1
1836+ #define NGHTTP3_PROTO_SETTINGS_VERSION NGHTTP3_PROTO_SETTINGS_V1
1837+
1838+ /**
1839+ * @struct
1840+ *
1841+ * :type:`nghttp3_proto_settings` contains HTTP/3 settings that this
1842+ * library can recognize. This field is available since v1.14.0.
1843+ */
1844+ typedef struct nghttp3_proto_settings {
1845+ /**
1846+ * :member:`max_field_section_size` specifies the maximum header
1847+ * section (block) size.
1848+ */
1849+ uint64_t max_field_section_size ;
1850+ /**
1851+ * :member:`qpack_max_dtable_capacity` is the maximum size of QPACK
1852+ * dynamic table.
1853+ */
1854+ size_t qpack_max_dtable_capacity ;
1855+ /**
1856+ * :member:`qpack_blocked_streams` is the maximum number of streams
1857+ * which can be blocked while they are being decoded.
1858+ */
1859+ size_t qpack_blocked_streams ;
1860+ /**
1861+ * :member:`enable_connect_protocol`, if set to nonzero, enables
1862+ * Extended CONNECT Method (see :rfc:`9220`). Client ignores this
1863+ * field.
1864+ */
1865+ uint8_t enable_connect_protocol ;
1866+ /**
1867+ * :member:`h3_datagram`, if set to nonzero, enables HTTP/3
1868+ * Datagrams (see :rfc:`9297`).
1869+ */
1870+ uint8_t h3_datagram ;
1871+ } nghttp3_proto_settings ;
1872+
18311873/**
18321874 * @functypedef
18331875 *
@@ -2052,6 +2094,11 @@ typedef int (*nghttp3_shutdown)(nghttp3_conn *conn, int64_t id,
20522094/**
20532095 * @functypedef
20542096 *
2097+ * .. warning::
2098+ *
2099+ * Deprecated since v1.14.0. Use :type:`nghttp3_recv_settings2`
2100+ * instead. New settings will not be notified with this callback.
2101+ *
20552102 * :type:`nghttp3_recv_settings` is a callback function which is
20562103 * invoked when SETTINGS frame is received. |settings| is a received
20572104 * remote HTTP/3 settings.
@@ -2103,9 +2150,27 @@ typedef int (*nghttp3_end_origin)(nghttp3_conn *conn, void *conn_user_data);
21032150 */
21042151typedef void (* nghttp3_rand )(uint8_t * dest , size_t destlen );
21052152
2153+ /**
2154+ * @functypedef
2155+ *
2156+ * :type:`nghttp3_recv_settings2` is a callback function which is
2157+ * invoked when SETTINGS frame is received. |settings| is a received
2158+ * remote HTTP/3 settings.
2159+ *
2160+ * The implementation of this callback must return 0 if it succeeds.
2161+ * Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2162+ * caller immediately. Any values other than 0 is treated as
2163+ * :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`. This callback is available
2164+ * since v1.14.0.
2165+ */
2166+ typedef int (* nghttp3_recv_settings2 )(nghttp3_conn * conn ,
2167+ const nghttp3_proto_settings * settings ,
2168+ void * conn_user_data );
2169+
21062170#define NGHTTP3_CALLBACKS_V1 1
21072171#define NGHTTP3_CALLBACKS_V2 2
2108- #define NGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V2
2172+ #define NGHTTP3_CALLBACKS_V3 3
2173+ #define NGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
21092174
21102175/**
21112176 * @struct
@@ -2195,6 +2260,11 @@ typedef struct nghttp3_callbacks {
21952260 */
21962261 nghttp3_shutdown shutdown ;
21972262 /**
2263+ * .. warning::
2264+ *
2265+ * Deprecated since v1.14.0. Use :member:`recv_settings2`
2266+ * instead.
2267+ *
21982268 * :member:`recv_settings` is a callback function which is invoked
21992269 * when SETTINGS frame is received.
22002270 */
@@ -2221,6 +2291,12 @@ typedef struct nghttp3_callbacks {
22212291 * v1.11.0.
22222292 */
22232293 nghttp3_rand rand ;
2294+ /**
2295+ * :member:`recv_settings2` is a callback function which is invoked
2296+ * when SETTINGS frame is received. This field is available since
2297+ * v1.14.0.
2298+ */
2299+ nghttp3_recv_settings2 recv_settings2 ;
22242300} nghttp3_callbacks ;
22252301
22262302/**
0 commit comments