Skip to content

Commit 8a9763a

Browse files
committed
deps: update nghttp3
PR-URL: #34033 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
1 parent 6b27d07 commit 8a9763a

17 files changed

Lines changed: 889 additions & 1046 deletions

deps/nghttp3/lib/includes/nghttp3/nghttp3.h

Lines changed: 122 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ extern "C" {
7070

7171
typedef ptrdiff_t nghttp3_ssize;
7272

73+
/* NGHTTP3_ALPN_H3 is a serialized form of HTTP/3 ALPN protocol
74+
identifier this library supports. Notice that the first byte is
75+
the length of the following protocol identifier. */
76+
#define NGHTTP3_ALPN_H3 "\x5h3-29"
77+
7378
typedef enum {
7479
NGHTTP3_ERR_INVALID_ARGUMENT = -101,
7580
NGHTTP3_ERR_NOBUF = -102,
@@ -476,7 +481,8 @@ typedef enum {
476481
NGHTTP3_QPACK_TOKEN_TRANSFER_ENCODING,
477482
NGHTTP3_QPACK_TOKEN_UPGRADE,
478483
NGHTTP3_QPACK_TOKEN_TE,
479-
NGHTTP3_QPACK_TOKEN__PROTOCOL
484+
NGHTTP3_QPACK_TOKEN__PROTOCOL,
485+
NGHTTP3_QPACK_TOKEN_PRIORITY
480486
} nghttp3_qpack_token;
481487

482488
/**
@@ -670,7 +676,7 @@ nghttp3_qpack_encoder_ack_header(nghttp3_qpack_encoder *encoder,
670676
*/
671677
NGHTTP3_EXTERN int
672678
nghttp3_qpack_encoder_add_insert_count(nghttp3_qpack_encoder *encoder,
673-
size_t n);
679+
uint64_t n);
674680

675681
/**
676682
* @function
@@ -748,7 +754,7 @@ nghttp3_qpack_stream_context_del(nghttp3_qpack_stream_context *sctx);
748754
* `nghttp3_qpack_stream_context_get_ricnt` returns required insert
749755
* count.
750756
*/
751-
NGHTTP3_EXTERN size_t
757+
NGHTTP3_EXTERN uint64_t
752758
nghttp3_qpack_stream_context_get_ricnt(nghttp3_qpack_stream_context *sctx);
753759

754760
struct nghttp3_qpack_decoder;
@@ -814,7 +820,7 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_qpack_decoder_read_encoder(
814820
*
815821
* `nghttp3_qpack_decoder_get_icnt` returns insert count.
816822
*/
817-
NGHTTP3_EXTERN size_t
823+
NGHTTP3_EXTERN uint64_t
818824
nghttp3_qpack_decoder_get_icnt(const nghttp3_qpack_decoder *decoder);
819825

820826
/**
@@ -863,7 +869,7 @@ typedef enum {
863869
* due to required insert count.
864870
*
865871
* When a header field is decoded, an application receives it in |nv|.
866-
* nv->name and nv->value are reference counted buffer, and the their
872+
* nv->name and nv->value are reference counted buffer, and their
867873
* reference counts are already incremented for application use.
868874
* Therefore, when application finishes processing the header field,
869875
* it must call nghttp3_rcbuf_decref(nv->name) and
@@ -1201,7 +1207,7 @@ typedef struct {
12011207
} nghttp3_conn_callbacks;
12021208

12031209
typedef struct {
1204-
uint64_t max_header_list_size;
1210+
uint64_t max_field_section_size;
12051211
uint64_t max_pushes;
12061212
size_t qpack_max_table_capacity;
12071213
size_t qpack_blocked_streams;
@@ -1259,79 +1265,6 @@ NGHTTP3_EXTERN int nghttp3_conn_bind_qpack_streams(nghttp3_conn *conn,
12591265
int64_t qenc_stream_id,
12601266
int64_t qdec_stream_id);
12611267

1262-
typedef enum {
1263-
NGHTTP3_FRAME_DATA = 0x00,
1264-
NGHTTP3_FRAME_HEADERS = 0x01,
1265-
NGHTTP3_FRAME_CANCEL_PUSH = 0x03,
1266-
NGHTTP3_FRAME_SETTINGS = 0x04,
1267-
NGHTTP3_FRAME_PUSH_PROMISE = 0x05,
1268-
NGHTTP3_FRAME_GOAWAY = 0x07,
1269-
NGHTTP3_FRAME_MAX_PUSH_ID = 0x0d,
1270-
} nghttp3_frame_type;
1271-
1272-
typedef struct {
1273-
int64_t type;
1274-
int64_t length;
1275-
} nghttp3_frame_hd;
1276-
1277-
typedef struct {
1278-
nghttp3_frame_hd hd;
1279-
} nghttp3_frame_data;
1280-
1281-
typedef struct {
1282-
nghttp3_frame_hd hd;
1283-
nghttp3_nv *nva;
1284-
size_t nvlen;
1285-
} nghttp3_frame_headers;
1286-
1287-
typedef struct {
1288-
nghttp3_frame_hd hd;
1289-
int64_t push_id;
1290-
} nghttp3_frame_cancel_push;
1291-
1292-
#define NGHTTP3_SETTINGS_ID_MAX_HEADER_LIST_SIZE 0x06
1293-
#define NGHTTP3_SETTINGS_ID_QPACK_MAX_TABLE_CAPACITY 0x01
1294-
#define NGHTTP3_SETTINGS_ID_QPACK_BLOCKED_STREAMS 0x07
1295-
1296-
typedef struct {
1297-
uint64_t id;
1298-
uint64_t value;
1299-
} nghttp3_settings_entry;
1300-
1301-
typedef struct {
1302-
nghttp3_frame_hd hd;
1303-
size_t niv;
1304-
nghttp3_settings_entry iv[1];
1305-
} nghttp3_frame_settings;
1306-
1307-
typedef struct {
1308-
nghttp3_frame_hd hd;
1309-
nghttp3_nv *nva;
1310-
size_t nvlen;
1311-
int64_t push_id;
1312-
} nghttp3_frame_push_promise;
1313-
1314-
typedef struct {
1315-
nghttp3_frame_hd hd;
1316-
int64_t stream_id;
1317-
} nghttp3_frame_goaway;
1318-
1319-
typedef struct {
1320-
nghttp3_frame_hd hd;
1321-
int64_t push_id;
1322-
} nghttp3_frame_max_push_id;
1323-
1324-
typedef union {
1325-
nghttp3_frame_hd hd;
1326-
nghttp3_frame_data data;
1327-
nghttp3_frame_headers headers;
1328-
nghttp3_frame_cancel_push cancel_push;
1329-
nghttp3_frame_settings settings;
1330-
nghttp3_frame_push_promise push_promise;
1331-
nghttp3_frame_goaway goaway;
1332-
nghttp3_frame_max_push_id max_push_id;
1333-
} nghttp3_frame;
1334-
13351268
/**
13361269
* @function
13371270
*
@@ -1393,7 +1326,7 @@ NGHTTP3_EXTERN int nghttp3_conn_add_write_offset(nghttp3_conn *conn,
13931326
* for stream denoted by |stream_id| QUIC stack has acknowledged.
13941327
*/
13951328
NGHTTP3_EXTERN int nghttp3_conn_add_ack_offset(nghttp3_conn *conn,
1396-
int64_t stream_id, size_t n);
1329+
int64_t stream_id, uint64_t n);
13971330

13981331
/**
13991332
* @function
@@ -1652,6 +1585,96 @@ NGHTTP3_EXTERN int nghttp3_conn_set_stream_user_data(nghttp3_conn *conn,
16521585
NGHTTP3_EXTERN int64_t nghttp3_conn_get_frame_payload_left(nghttp3_conn *conn,
16531586
int64_t stream_id);
16541587

1588+
/**
1589+
* @macro
1590+
*
1591+
* :macro:`NGHTTP3_DEFAULT_URGENCY` is the default urgency level.
1592+
*/
1593+
#define NGHTTP3_DEFAULT_URGENCY 1
1594+
1595+
/**
1596+
* @macro
1597+
*
1598+
* :macro:`NGHTTP3_URGENCY_HIGH` is the highest urgency level.
1599+
*/
1600+
#define NGHTTP3_URGENCY_HIGH 0
1601+
1602+
/**
1603+
* @macro
1604+
*
1605+
* :macro:`NGHTTP3_URGENCY_LOW` is the lowest urgency level.
1606+
*/
1607+
#define NGHTTP3_URGENCY_LOW 7
1608+
1609+
/**
1610+
* @macro
1611+
*
1612+
* :macro:`NGHTTP3_URGENCY_LEVELS` is the number of urgency levels.
1613+
*/
1614+
#define NGHTTP3_URGENCY_LEVELS (NGHTTP3_URGENCY_LOW + 1)
1615+
1616+
/**
1617+
* @struct
1618+
*
1619+
* :type:`nghttp3_pri` represents HTTP priority.
1620+
*/
1621+
typedef struct nghttp3_pri {
1622+
/**
1623+
* urgency is the urgency of a stream, it must be in
1624+
* [NGHTTP3_URGENCY_HIGH, NGHTTP3_URGENCY_LOW], inclusive, and 0 is
1625+
* the highest urgency.
1626+
*/
1627+
uint32_t urgency;
1628+
/**
1629+
* inc indicates that a content can be processed incrementally or
1630+
* not. If inc is 0, it cannot be processed incrementally. If inc
1631+
* is 1, it can be processed incrementally. Other value is not
1632+
* permitted.
1633+
*/
1634+
int inc;
1635+
} nghttp3_pri;
1636+
1637+
/**
1638+
* @function
1639+
*
1640+
* `nghttp3_conn_get_stream_priority` stores stream priority of a
1641+
* stream denoted by |stream_id| into |*dest|. Only server can use
1642+
* this function.
1643+
*
1644+
* This function must not be called if |conn| is initialized as
1645+
* client.
1646+
*
1647+
* This function returns 0 if it succeeds, or one of the following
1648+
* negative error codes:
1649+
*
1650+
* :enum:`NGHTTP3_ERR_STREAM_NOT_FOUND`
1651+
* Stream not found.
1652+
*/
1653+
NGHTTP3_EXTERN int nghttp3_conn_get_stream_priority(nghttp3_conn *conn,
1654+
nghttp3_pri *dest,
1655+
int64_t stream_id);
1656+
1657+
/**
1658+
* @function
1659+
*
1660+
* `nghttp3_conn_set_stream_priority` updates stream priority of a
1661+
* stream denoted by |stream_id| by the value pointed by |pri|.
1662+
*
1663+
* This function must not be called if |conn| is initialized as
1664+
* client.
1665+
*
1666+
* This function returns 0 if it succeeds, or one of the following
1667+
* negative error codes:
1668+
*
1669+
* :enum:`NGHTTP3_ERR_STREAM_NOT_FOUND`
1670+
* Stream not found.
1671+
* :enum:`NGHTTP3_ERR_NOMEM`
1672+
* Out of memory.
1673+
*/
1674+
NGHTTP3_EXTERN int nghttp3_conn_set_stream_priority(nghttp3_conn *conn,
1675+
int64_t stream_id,
1676+
const nghttp3_pri *pri);
1677+
16551678
/**
16561679
* @function
16571680
*
@@ -1710,6 +1733,25 @@ NGHTTP3_EXTERN int nghttp3_check_header_name(const uint8_t *name, size_t len);
17101733
*/
17111734
NGHTTP3_EXTERN int nghttp3_check_header_value(const uint8_t *value, size_t len);
17121735

1736+
/**
1737+
* @function
1738+
*
1739+
* `nghttp3_http_parse_priority` parses priority HTTP header field
1740+
* stored in the buffer pointed by |value| of length |len|. If it
1741+
* successfully processed header field value, it stores the result
1742+
* into |*dest|. This function just overwrites what it sees in the
1743+
* header field value and does not initialize any field in |*dest|.
1744+
*
1745+
* This function returns 0 if it succeeds, or one of the following
1746+
* negative error codes:
1747+
*
1748+
* :enum:`NGHTTP3_ERR_INVALID_ARGUMENT`
1749+
* The function could not parse the provided value.
1750+
*/
1751+
NGHTTP3_EXTERN int nghttp3_http_parse_priority(nghttp3_pri *dest,
1752+
const uint8_t *value,
1753+
size_t len);
1754+
17131755
/**
17141756
* @macro
17151757
*

deps/nghttp3/lib/includes/nghttp3/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* Version number of the nghttp3 library release.
3333
*/
34-
#define NGHTTP3_VERSION "0.1.90"
34+
#define NGHTTP3_VERSION "0.1.0-DEV"
3535

3636
/**
3737
* @macro
@@ -41,6 +41,6 @@
4141
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
4242
* becomes 0x010203.
4343
*/
44-
#define NGHTTP3_VERSION_NUM 0x00015a
44+
#define NGHTTP3_VERSION_NUM 0x000100
4545

4646
#endif /* NGHTTP3_VERSION_H */

0 commit comments

Comments
 (0)