deps: update nghttp3 to 1.18.0 · nodejs/node@d5a57ed · GitHub
Skip to content

Commit d5a57ed

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.18.0
PR-URL: #64943 Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 331e5e8 commit d5a57ed

10 files changed

Lines changed: 227 additions & 51 deletions

File tree

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

Lines changed: 125 additions & 2 deletions

deps/ngtcp2/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 "1.17.0"
34+
#define NGHTTP3_VERSION "1.18.0"
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 0x011100
44+
#define NGHTTP3_VERSION_NUM 0x011200
4545

4646
#endif /* !defined(NGHTTP3_VERSION_H) */

deps/ngtcp2/nghttp3/lib/nghttp3_callbacks.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ size_t nghttp3_callbackslen_version(int callbacks_version) {
6666
switch (callbacks_version) {
6767
case NGHTTP3_CALLBACKS_VERSION:
6868
return sizeof(callbacks);
69+
case NGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
case NGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) + sizeof(callbacks.rand);
7174
case NGHTTP3_CALLBACKS_V1:

deps/ngtcp2/nghttp3/lib/nghttp3_conn.c

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,9 @@ static nghttp3_ssize conn_read_type(nghttp3_conn *conn, nghttp3_stream *stream,
623623
return nread;
624624
}
625625

626-
static int conn_delete_stream(nghttp3_conn *conn, nghttp3_stream *stream);
626+
static int conn_delete_stream(nghttp3_conn *conn, nghttp3_stream *stream,
627+
uint32_t flags, uint64_t rx_app_error_code,
628+
uint64_t tx_app_error_code);
627629

628630
nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
629631
const uint8_t *src, size_t srclen, int fin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
return NGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
return conn_delete_stream(conn, stream);
654+
return conn_delete_stream(conn, stream, NGHTTP3_STREAM_CLOSE_FLAG_NONE, 0,
655+
0);
653656
}
654657
nread = conn_read_type(conn, stream, src, srclen, fin);
655658
if (nread < 0) {
@@ -1200,7 +1203,7 @@ nghttp3_ssize nghttp3_conn_read_control(nghttp3_conn *conn,
12001203
for (; conn->rx.originlen_offset < sizeof(conn->rx.originlen) &&
12011204
(size_t)nread < len;
12021205
++conn->rx.originlen_offset, ++nread) {
1203-
conn->rx.originlen <<= 8;
1206+
conn->rx.originlen *= 256;
12041207
conn->rx.originlen += *p++;
12051208
}
12061209

@@ -1335,8 +1338,11 @@ nghttp3_ssize nghttp3_conn_read_control(nghttp3_conn *conn,
13351338
return (nghttp3_ssize)nconsumed;
13361339
}
13371340

1338-
static int conn_delete_stream(nghttp3_conn *conn, nghttp3_stream *stream) {
1341+
static int conn_delete_stream(nghttp3_conn *conn, nghttp3_stream *stream,
1342+
uint32_t flags, uint64_t rx_app_error_code,
1343+
uint64_t tx_app_error_code) {
13391344
int rv;
1345+
uint64_t app_error_code;
13401346

13411347
rv = conn_call_deferred_consume(conn, stream,
13421348
nghttp3_stream_get_buffered_datalen(stream));
@@ -1353,8 +1359,26 @@ static int conn_delete_stream(nghttp3_conn *conn, nghttp3_stream *stream) {
13531359
}
13541360
}
13551361

1356-
if (conn->callbacks.stream_close) {
1357-
rv = conn->callbacks.stream_close(conn, stream->node.id, stream->error_code,
1362+
if (conn->callbacks.stream_close2) {
1363+
rv = conn->callbacks.stream_close2(conn, flags, stream->node.id,
1364+
rx_app_error_code, tx_app_error_code,
1365+
conn->user_data, stream->user_data);
1366+
if (rv != 0) {
1367+
return NGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} else if (conn->callbacks.stream_close) {
1370+
app_error_code = NGHTTP3_H3_NO_ERROR;
1371+
1372+
if (flags & NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET) {
1373+
app_error_code = rx_app_error_code;
1374+
}
1375+
1376+
if (app_error_code == NGHTTP3_H3_NO_ERROR &&
1377+
(flags & NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET)) {
1378+
app_error_code = tx_app_error_code;
1379+
}
1380+
1381+
rv = conn->callbacks.stream_close(conn, stream->node.id, app_error_code,
13581382
conn->user_data, stream->user_data);
13591383
if (rv != 0) {
13601384
return NGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
int nghttp3_conn_close_stream(nghttp3_conn *conn, int64_t stream_id,
27272751
uint64_t app_error_code) {
2752+
return nghttp3_conn_close_stream2(
2753+
conn,
2754+
NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET |
2755+
NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET,
2756+
stream_id, app_error_code, app_error_code);
2757+
}
2758+
2759+
int nghttp3_conn_close_stream2(nghttp3_conn *conn, uint32_t flags,
2760+
int64_t stream_id, uint64_t rx_app_error_code,
2761+
uint64_t tx_app_error_code) {
27282762
nghttp3_stream *stream = nghttp3_conn_find_stream(conn, stream_id);
27292763

27302764
if (stream == NULL) {
@@ -2736,11 +2770,10 @@ int nghttp3_conn_close_stream(nghttp3_conn *conn, int64_t stream_id,
27362770
return NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

2739-
stream->error_code = app_error_code;
2740-
27412773
nghttp3_conn_unschedule_stream(conn, stream);
27422774

2743-
return conn_delete_stream(conn, stream);
2775+
return conn_delete_stream(conn, stream, flags, rx_app_error_code,
2776+
tx_app_error_code);
27442777
}
27452778

27462779
int nghttp3_conn_shutdown_stream_read(nghttp3_conn *conn, int64_t stream_id) {

deps/ngtcp2/nghttp3/lib/nghttp3_ksl.c

Lines changed: 12 additions & 10 deletions

0 commit comments

Comments
 (0)