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
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19611961
/**
19621962
* @functypedef
19631963
*
1964-
* :type:`nghttp3_conn_stream_close` is a callback function which is
1964+
* :type:`nghttp3_stream_close` is a callback function which is
19651965
* invoked when a stream identified by |stream_id| is closed. QUIC
19661966
* application error code |app_error_code| indicates the reason of
19671967
* this closure.
@@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19701970
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
19711971
* caller immediately. Any values other than 0 is treated as
19721972
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
1973+
*
1974+
* .. seealso::
1975+
* :type:`nghttp3_stream_close2`
19731976
*/
19741977
typedefint (*nghttp3_stream_close)(nghttp3_conn*conn, int64_tstream_id,
19751978
uint64_tapp_error_code,
@@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
22402243
constnghttp3_proto_settings*settings,
22412244
void*conn_user_data);
22422245

2246+
/**
2247+
* @macrosection
2248+
*
2249+
* Stream close flags
2250+
*/
2251+
2252+
/**
2253+
* @macro
2254+
*
2255+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
2256+
*
2257+
* .. version-added:: 1.18.0
2258+
*/
2259+
#defineNGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U
2260+
2261+
/**
2262+
* @macro
2263+
*
2264+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
2265+
* that rx_app_error_code parameter is set.
2266+
*
2267+
* .. version-added:: 1.18.0
2268+
*/
2269+
#defineNGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U
2270+
2271+
/**
2272+
* @macro
2273+
*
2274+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
2275+
* that tx_app_error_code parameter is set.
2276+
*
2277+
* .. version-added:: 1.18.0
2278+
*/
2279+
#defineNGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
2280+
2281+
/**
2282+
* @functypedef
2283+
*
2284+
* :type:`nghttp3_stream_close2` is a callback function which is
2285+
* invoked when a stream identified by |stream_id| is closed. If
2286+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2287+
* |flags|, |rx_app_error_code| is the QUIC application error code
2288+
* that shut down the receiving side of the stream. If
2289+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2290+
* |flags|, |tx_app_error_code| is the QUIC application error code
2291+
* that shut down the sending side of the stream. No application code
2292+
* means that direction of stream is closed without any error.
2293+
*
2294+
* This callback should be used with `nghttp3_conn_close_stream2`. If
2295+
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
2296+
* both |rx_app_error_code| and |tx_app_error_code|, and
2297+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
2298+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
2299+
* |flags|.
2300+
*
2301+
* The implementation of this callback must return 0 if it succeeds.
2302+
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2303+
* caller immediately. Any values other than 0 is treated as
2304+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
2305+
*
2306+
* .. version-added:: 1.18.0
2307+
*/
2308+
typedefint (*nghttp3_stream_close2)(nghttp3_conn*conn, uint32_tflags,
2309+
int64_tstream_id,
2310+
uint64_trx_app_error_code,
2311+
uint64_ttx_app_error_code,
2312+
void*conn_user_data,
2313+
void*stream_user_data);
2314+
22432315
#defineNGHTTP3_CALLBACKS_V1 1
22442316
#defineNGHTTP3_CALLBACKS_V2 2
22452317
#defineNGHTTP3_CALLBACKS_V3 3
2246-
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
2318+
#defineNGHTTP3_CALLBACKS_V4 4
2319+
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
22472320

22482321
/**
22492322
* @struct
@@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
22602333
/**
22612334
* :member:`stream_close` is a callback function which is invoked
22622335
* when a particular stream has closed.
2336+
*
2337+
* .. seealso::
2338+
* :member:`stream_close2`
22632339
*/
22642340
nghttp3_stream_closestream_close;
22652341
/**
@@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
23682444
* .. version-added:: 1.11.0
23692445
*/
23702446
nghttp3_randrand;
2447+
/* The following fields have been added since
2448+
NGHTTP3_CALLBACKS_V3. */
23712449
/**
23722450
* :member:`recv_settings2` is a callback function which is invoked
23732451
* when SETTINGS frame is received.
23742452
*
23752453
* .. version-added:: 1.14.0
23762454
*/
23772455
nghttp3_recv_settings2recv_settings2;
2456+
/* The following fields have been added since
2457+
NGHTTP3_CALLBACKS_V4. */
2458+
/**
2459+
* :member:`stream_close2` is a callback function which is invoked
2460+
* when a particular stream has closed.
2461+
*
2462+
* .. version-added:: 1.18.0
2463+
*/
2464+
nghttp3_stream_close2stream_close2;
23782465
} nghttp3_callbacks;
23792466

23802467
/**
@@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
28372924
* A critical stream is closed.
28382925
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
28392926
* User callback failed
2927+
*
2928+
* .. seealso::
2929+
* `nghttp3_conn_close_stream2`
28402930
*/
28412931
NGHTTP3_EXTERNintnghttp3_conn_close_stream(nghttp3_conn*conn,
28422932
int64_tstream_id,
28432933
uint64_tapp_error_code);
28442934

2935+
/**
2936+
* @function
2937+
*
2938+
* `nghttp3_conn_close_stream2` tells the library that a stream
2939+
* identified by |stream_id| has been closed. If
2940+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2941+
* |flags|, |rx_app_error_code| is the QUIC application error code
2942+
* that shut down the receiving side of the stream. Similarly,
2943+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2944+
* |flags|, |tx_app_error_code| is the QUIC application error code
2945+
* that shut down the sending side of the stream.
2946+
*
2947+
* For stream close callback, prefer
2948+
* :member:`nghttp3_callbacks.stream_close2` to
2949+
* :member:`nghttp3_callbacks.stream_close`.
2950+
*
2951+
* This function returns 0 if it succeeds, or one of the following
2952+
* negative error codes:
2953+
*
2954+
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
2955+
* Stream not found.
2956+
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
2957+
* A critical stream is closed.
2958+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2959+
* User callback failed
2960+
*
2961+
* .. version-added:: 1.18.0
2962+
*/
2963+
NGHTTP3_EXTERNintnghttp3_conn_close_stream2(nghttp3_conn*conn,
2964+
uint32_tflags, int64_tstream_id,
2965+
uint64_trx_app_error_code,
2966+
uint64_ttx_app_error_code);
2967+
28452968
/**
28462969
* @macrosection
28472970
*

β€Ž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-
#defineNGHTTP3_VERSION "1.17.0"
34+
#defineNGHTTP3_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-
#defineNGHTTP3_VERSION_NUM0x011100
44+
#defineNGHTTP3_VERSION_NUM0x011200
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
caseNGHTTP3_CALLBACKS_VERSION:
6868
returnsizeof(callbacks);
69+
caseNGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
caseNGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) +sizeof(callbacks.rand);
7174
caseNGHTTP3_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
returnnread;
624624
}
625625

626-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream);
626+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
627+
uint32_tflags, uint64_trx_app_error_code,
628+
uint64_ttx_app_error_code);
627629

628630
nghttp3_ssizenghttp3_conn_read_uni(nghttp3_conn*conn, nghttp3_stream*stream,
629631
constuint8_t*src, size_tsrclen, intfin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
returnNGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
returnconn_delete_stream(conn, stream);
654+
returnconn_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-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream) {
1341+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
1342+
uint32_tflags, uint64_trx_app_error_code,
1343+
uint64_ttx_app_error_code) {
13391344
intrv;
1345+
uint64_tapp_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+
returnNGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} elseif (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
returnNGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
intnghttp3_conn_close_stream(nghttp3_conn*conn, int64_tstream_id,
27272751
uint64_tapp_error_code) {
2752+
returnnghttp3_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+
intnghttp3_conn_close_stream2(nghttp3_conn*conn, uint32_tflags,
2760+
int64_tstream_id, uint64_trx_app_error_code,
2761+
uint64_ttx_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
returnNGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

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

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

27462779
intnghttp3_conn_shutdown_stream_read(nghttp3_conn*conn, int64_tstream_id) {

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_ksl.cβ€Ž

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ static nghttp3_ksl_blk null_blk;
3737

3838
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
3939

40+
#defineNGHTTP3_KSL_ALIGNED_BLKLEN \
41+
((sizeof(nghttp3_ksl_blk) + 0x7U) & ~(size_t)0x7U)
42+
4043
staticsize_tksl_blklen(size_taligned_keylen) {
41-
returnsizeof(nghttp3_ksl_blk)+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
44+
returnNGHTTP3_KSL_ALIGNED_BLKLEN+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
4245
}
4346

4447
/*
@@ -80,7 +83,7 @@ static nghttp3_ksl_blk *ksl_blk_objalloc_new(nghttp3_ksl *ksl) {
8083
returnNULL;
8184
}
8285

83-
blk->keys= (uint8_t*)blk+sizeof(*blk);
86+
blk->keys= (uint8_t*)blk+NGHTTP3_KSL_ALIGNED_BLKLEN;
8487
blk->aligned_keylen= (uint16_t)ksl->aligned_keylen;
8588

8689
returnblk;
@@ -223,22 +226,21 @@ static int ksl_split_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i) {
223226
* Out of memory.
224227
*/
225228
staticintksl_split_root(nghttp3_ksl*ksl) {
226-
nghttp3_ksl_blk*rblk=NULL, *lblk, *nroot=NULL;
229+
nghttp3_ksl_blk*rblk, *lblk, *nroot;
230+
231+
nroot=ksl_blk_objalloc_new(ksl);
232+
if (nroot==NULL) {
233+
returnNGHTTP3_ERR_NOMEM;
234+
}
227235

228236
rblk=ksl_split_blk(ksl, ksl->root);
229237
if (rblk==NULL) {
238+
ksl_blk_objalloc_del(ksl, nroot);
230239
returnNGHTTP3_ERR_NOMEM;
231240
}
232241

233242
lblk=ksl->root;
234243

235-
nroot=ksl_blk_objalloc_new(ksl);
236-
237-
if (nroot==NULL) {
238-
ksl_blk_objalloc_del(ksl, rblk);
239-
returnNGHTTP3_ERR_NOMEM;
240-
}
241-
242244
nroot->next=nroot->prev=NULL;
243245
nroot->n=2;
244246
nroot->leaf=0;

0 commit comments

Comments
Β (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
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
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19611961
/**
19621962
* @functypedef
19631963
*
1964-
* :type:`nghttp3_conn_stream_close` is a callback function which is
1964+
* :type:`nghttp3_stream_close` is a callback function which is
19651965
* invoked when a stream identified by |stream_id| is closed. QUIC
19661966
* application error code |app_error_code| indicates the reason of
19671967
* this closure.
@@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19701970
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
19711971
* caller immediately. Any values other than 0 is treated as
19721972
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
1973+
*
1974+
* .. seealso::
1975+
* :type:`nghttp3_stream_close2`
19731976
*/
19741977
typedefint (*nghttp3_stream_close)(nghttp3_conn*conn, int64_tstream_id,
19751978
uint64_tapp_error_code,
@@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
22402243
constnghttp3_proto_settings*settings,
22412244
void*conn_user_data);
22422245

2246+
/**
2247+
* @macrosection
2248+
*
2249+
* Stream close flags
2250+
*/
2251+
2252+
/**
2253+
* @macro
2254+
*
2255+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
2256+
*
2257+
* .. version-added:: 1.18.0
2258+
*/
2259+
#defineNGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U
2260+
2261+
/**
2262+
* @macro
2263+
*
2264+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
2265+
* that rx_app_error_code parameter is set.
2266+
*
2267+
* .. version-added:: 1.18.0
2268+
*/
2269+
#defineNGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U
2270+
2271+
/**
2272+
* @macro
2273+
*
2274+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
2275+
* that tx_app_error_code parameter is set.
2276+
*
2277+
* .. version-added:: 1.18.0
2278+
*/
2279+
#defineNGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
2280+
2281+
/**
2282+
* @functypedef
2283+
*
2284+
* :type:`nghttp3_stream_close2` is a callback function which is
2285+
* invoked when a stream identified by |stream_id| is closed. If
2286+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2287+
* |flags|, |rx_app_error_code| is the QUIC application error code
2288+
* that shut down the receiving side of the stream. If
2289+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2290+
* |flags|, |tx_app_error_code| is the QUIC application error code
2291+
* that shut down the sending side of the stream. No application code
2292+
* means that direction of stream is closed without any error.
2293+
*
2294+
* This callback should be used with `nghttp3_conn_close_stream2`. If
2295+
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
2296+
* both |rx_app_error_code| and |tx_app_error_code|, and
2297+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
2298+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
2299+
* |flags|.
2300+
*
2301+
* The implementation of this callback must return 0 if it succeeds.
2302+
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2303+
* caller immediately. Any values other than 0 is treated as
2304+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
2305+
*
2306+
* .. version-added:: 1.18.0
2307+
*/
2308+
typedefint (*nghttp3_stream_close2)(nghttp3_conn*conn, uint32_tflags,
2309+
int64_tstream_id,
2310+
uint64_trx_app_error_code,
2311+
uint64_ttx_app_error_code,
2312+
void*conn_user_data,
2313+
void*stream_user_data);
2314+
22432315
#defineNGHTTP3_CALLBACKS_V1 1
22442316
#defineNGHTTP3_CALLBACKS_V2 2
22452317
#defineNGHTTP3_CALLBACKS_V3 3
2246-
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
2318+
#defineNGHTTP3_CALLBACKS_V4 4
2319+
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
22472320

22482321
/**
22492322
* @struct
@@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
22602333
/**
22612334
* :member:`stream_close` is a callback function which is invoked
22622335
* when a particular stream has closed.
2336+
*
2337+
* .. seealso::
2338+
* :member:`stream_close2`
22632339
*/
22642340
nghttp3_stream_closestream_close;
22652341
/**
@@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
23682444
* .. version-added:: 1.11.0
23692445
*/
23702446
nghttp3_randrand;
2447+
/* The following fields have been added since
2448+
NGHTTP3_CALLBACKS_V3. */
23712449
/**
23722450
* :member:`recv_settings2` is a callback function which is invoked
23732451
* when SETTINGS frame is received.
23742452
*
23752453
* .. version-added:: 1.14.0
23762454
*/
23772455
nghttp3_recv_settings2recv_settings2;
2456+
/* The following fields have been added since
2457+
NGHTTP3_CALLBACKS_V4. */
2458+
/**
2459+
* :member:`stream_close2` is a callback function which is invoked
2460+
* when a particular stream has closed.
2461+
*
2462+
* .. version-added:: 1.18.0
2463+
*/
2464+
nghttp3_stream_close2stream_close2;
23782465
} nghttp3_callbacks;
23792466

23802467
/**
@@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
28372924
* A critical stream is closed.
28382925
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
28392926
* User callback failed
2927+
*
2928+
* .. seealso::
2929+
* `nghttp3_conn_close_stream2`
28402930
*/
28412931
NGHTTP3_EXTERNintnghttp3_conn_close_stream(nghttp3_conn*conn,
28422932
int64_tstream_id,
28432933
uint64_tapp_error_code);
28442934

2935+
/**
2936+
* @function
2937+
*
2938+
* `nghttp3_conn_close_stream2` tells the library that a stream
2939+
* identified by |stream_id| has been closed. If
2940+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2941+
* |flags|, |rx_app_error_code| is the QUIC application error code
2942+
* that shut down the receiving side of the stream. Similarly,
2943+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2944+
* |flags|, |tx_app_error_code| is the QUIC application error code
2945+
* that shut down the sending side of the stream.
2946+
*
2947+
* For stream close callback, prefer
2948+
* :member:`nghttp3_callbacks.stream_close2` to
2949+
* :member:`nghttp3_callbacks.stream_close`.
2950+
*
2951+
* This function returns 0 if it succeeds, or one of the following
2952+
* negative error codes:
2953+
*
2954+
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
2955+
* Stream not found.
2956+
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
2957+
* A critical stream is closed.
2958+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2959+
* User callback failed
2960+
*
2961+
* .. version-added:: 1.18.0
2962+
*/
2963+
NGHTTP3_EXTERNintnghttp3_conn_close_stream2(nghttp3_conn*conn,
2964+
uint32_tflags, int64_tstream_id,
2965+
uint64_trx_app_error_code,
2966+
uint64_ttx_app_error_code);
2967+
28452968
/**
28462969
* @macrosection
28472970
*

β€Ž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-
#defineNGHTTP3_VERSION "1.17.0"
34+
#defineNGHTTP3_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-
#defineNGHTTP3_VERSION_NUM0x011100
44+
#defineNGHTTP3_VERSION_NUM0x011200
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
caseNGHTTP3_CALLBACKS_VERSION:
6868
returnsizeof(callbacks);
69+
caseNGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
caseNGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) +sizeof(callbacks.rand);
7174
caseNGHTTP3_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
returnnread;
624624
}
625625

626-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream);
626+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
627+
uint32_tflags, uint64_trx_app_error_code,
628+
uint64_ttx_app_error_code);
627629

628630
nghttp3_ssizenghttp3_conn_read_uni(nghttp3_conn*conn, nghttp3_stream*stream,
629631
constuint8_t*src, size_tsrclen, intfin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
returnNGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
returnconn_delete_stream(conn, stream);
654+
returnconn_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-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream) {
1341+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
1342+
uint32_tflags, uint64_trx_app_error_code,
1343+
uint64_ttx_app_error_code) {
13391344
intrv;
1345+
uint64_tapp_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+
returnNGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} elseif (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
returnNGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
intnghttp3_conn_close_stream(nghttp3_conn*conn, int64_tstream_id,
27272751
uint64_tapp_error_code) {
2752+
returnnghttp3_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+
intnghttp3_conn_close_stream2(nghttp3_conn*conn, uint32_tflags,
2760+
int64_tstream_id, uint64_trx_app_error_code,
2761+
uint64_ttx_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
returnNGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

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

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

27462779
intnghttp3_conn_shutdown_stream_read(nghttp3_conn*conn, int64_tstream_id) {

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_ksl.cβ€Ž

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ static nghttp3_ksl_blk null_blk;
3737

3838
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
3939

40+
#defineNGHTTP3_KSL_ALIGNED_BLKLEN \
41+
((sizeof(nghttp3_ksl_blk) + 0x7U) & ~(size_t)0x7U)
42+
4043
staticsize_tksl_blklen(size_taligned_keylen) {
41-
returnsizeof(nghttp3_ksl_blk)+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
44+
returnNGHTTP3_KSL_ALIGNED_BLKLEN+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
4245
}
4346

4447
/*
@@ -80,7 +83,7 @@ static nghttp3_ksl_blk *ksl_blk_objalloc_new(nghttp3_ksl *ksl) {
8083
returnNULL;
8184
}
8285

83-
blk->keys= (uint8_t*)blk+sizeof(*blk);
86+
blk->keys= (uint8_t*)blk+NGHTTP3_KSL_ALIGNED_BLKLEN;
8487
blk->aligned_keylen= (uint16_t)ksl->aligned_keylen;
8588

8689
returnblk;
@@ -223,22 +226,21 @@ static int ksl_split_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i) {
223226
* Out of memory.
224227
*/
225228
staticintksl_split_root(nghttp3_ksl*ksl) {
226-
nghttp3_ksl_blk*rblk=NULL, *lblk, *nroot=NULL;
229+
nghttp3_ksl_blk*rblk, *lblk, *nroot;
230+
231+
nroot=ksl_blk_objalloc_new(ksl);
232+
if (nroot==NULL) {
233+
returnNGHTTP3_ERR_NOMEM;
234+
}
227235

228236
rblk=ksl_split_blk(ksl, ksl->root);
229237
if (rblk==NULL) {
238+
ksl_blk_objalloc_del(ksl, nroot);
230239
returnNGHTTP3_ERR_NOMEM;
231240
}
232241

233242
lblk=ksl->root;
234243

235-
nroot=ksl_blk_objalloc_new(ksl);
236-
237-
if (nroot==NULL) {
238-
ksl_blk_objalloc_del(ksl, rblk);
239-
returnNGHTTP3_ERR_NOMEM;
240-
}
241-
242244
nroot->next=nroot->prev=NULL;
243245
nroot->n=2;
244246
nroot->leaf=0;

0 commit comments

Comments
Β (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19611961
/**
19621962
* @functypedef
19631963
*
1964-
* :type:`nghttp3_conn_stream_close` is a callback function which is
1964+
* :type:`nghttp3_stream_close` is a callback function which is
19651965
* invoked when a stream identified by |stream_id| is closed. QUIC
19661966
* application error code |app_error_code| indicates the reason of
19671967
* this closure.
@@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19701970
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
19711971
* caller immediately. Any values other than 0 is treated as
19721972
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
1973+
*
1974+
* .. seealso::
1975+
* :type:`nghttp3_stream_close2`
19731976
*/
19741977
typedefint (*nghttp3_stream_close)(nghttp3_conn*conn, int64_tstream_id,
19751978
uint64_tapp_error_code,
@@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
22402243
constnghttp3_proto_settings*settings,
22412244
void*conn_user_data);
22422245

2246+
/**
2247+
* @macrosection
2248+
*
2249+
* Stream close flags
2250+
*/
2251+
2252+
/**
2253+
* @macro
2254+
*
2255+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
2256+
*
2257+
* .. version-added:: 1.18.0
2258+
*/
2259+
#defineNGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U
2260+
2261+
/**
2262+
* @macro
2263+
*
2264+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
2265+
* that rx_app_error_code parameter is set.
2266+
*
2267+
* .. version-added:: 1.18.0
2268+
*/
2269+
#defineNGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U
2270+
2271+
/**
2272+
* @macro
2273+
*
2274+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
2275+
* that tx_app_error_code parameter is set.
2276+
*
2277+
* .. version-added:: 1.18.0
2278+
*/
2279+
#defineNGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
2280+
2281+
/**
2282+
* @functypedef
2283+
*
2284+
* :type:`nghttp3_stream_close2` is a callback function which is
2285+
* invoked when a stream identified by |stream_id| is closed. If
2286+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2287+
* |flags|, |rx_app_error_code| is the QUIC application error code
2288+
* that shut down the receiving side of the stream. If
2289+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2290+
* |flags|, |tx_app_error_code| is the QUIC application error code
2291+
* that shut down the sending side of the stream. No application code
2292+
* means that direction of stream is closed without any error.
2293+
*
2294+
* This callback should be used with `nghttp3_conn_close_stream2`. If
2295+
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
2296+
* both |rx_app_error_code| and |tx_app_error_code|, and
2297+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
2298+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
2299+
* |flags|.
2300+
*
2301+
* The implementation of this callback must return 0 if it succeeds.
2302+
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2303+
* caller immediately. Any values other than 0 is treated as
2304+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
2305+
*
2306+
* .. version-added:: 1.18.0
2307+
*/
2308+
typedefint (*nghttp3_stream_close2)(nghttp3_conn*conn, uint32_tflags,
2309+
int64_tstream_id,
2310+
uint64_trx_app_error_code,
2311+
uint64_ttx_app_error_code,
2312+
void*conn_user_data,
2313+
void*stream_user_data);
2314+
22432315
#defineNGHTTP3_CALLBACKS_V1 1
22442316
#defineNGHTTP3_CALLBACKS_V2 2
22452317
#defineNGHTTP3_CALLBACKS_V3 3
2246-
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
2318+
#defineNGHTTP3_CALLBACKS_V4 4
2319+
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
22472320

22482321
/**
22492322
* @struct
@@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
22602333
/**
22612334
* :member:`stream_close` is a callback function which is invoked
22622335
* when a particular stream has closed.
2336+
*
2337+
* .. seealso::
2338+
* :member:`stream_close2`
22632339
*/
22642340
nghttp3_stream_closestream_close;
22652341
/**
@@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
23682444
* .. version-added:: 1.11.0
23692445
*/
23702446
nghttp3_randrand;
2447+
/* The following fields have been added since
2448+
NGHTTP3_CALLBACKS_V3. */
23712449
/**
23722450
* :member:`recv_settings2` is a callback function which is invoked
23732451
* when SETTINGS frame is received.
23742452
*
23752453
* .. version-added:: 1.14.0
23762454
*/
23772455
nghttp3_recv_settings2recv_settings2;
2456+
/* The following fields have been added since
2457+
NGHTTP3_CALLBACKS_V4. */
2458+
/**
2459+
* :member:`stream_close2` is a callback function which is invoked
2460+
* when a particular stream has closed.
2461+
*
2462+
* .. version-added:: 1.18.0
2463+
*/
2464+
nghttp3_stream_close2stream_close2;
23782465
} nghttp3_callbacks;
23792466

23802467
/**
@@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
28372924
* A critical stream is closed.
28382925
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
28392926
* User callback failed
2927+
*
2928+
* .. seealso::
2929+
* `nghttp3_conn_close_stream2`
28402930
*/
28412931
NGHTTP3_EXTERNintnghttp3_conn_close_stream(nghttp3_conn*conn,
28422932
int64_tstream_id,
28432933
uint64_tapp_error_code);
28442934

2935+
/**
2936+
* @function
2937+
*
2938+
* `nghttp3_conn_close_stream2` tells the library that a stream
2939+
* identified by |stream_id| has been closed. If
2940+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2941+
* |flags|, |rx_app_error_code| is the QUIC application error code
2942+
* that shut down the receiving side of the stream. Similarly,
2943+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2944+
* |flags|, |tx_app_error_code| is the QUIC application error code
2945+
* that shut down the sending side of the stream.
2946+
*
2947+
* For stream close callback, prefer
2948+
* :member:`nghttp3_callbacks.stream_close2` to
2949+
* :member:`nghttp3_callbacks.stream_close`.
2950+
*
2951+
* This function returns 0 if it succeeds, or one of the following
2952+
* negative error codes:
2953+
*
2954+
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
2955+
* Stream not found.
2956+
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
2957+
* A critical stream is closed.
2958+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2959+
* User callback failed
2960+
*
2961+
* .. version-added:: 1.18.0
2962+
*/
2963+
NGHTTP3_EXTERNintnghttp3_conn_close_stream2(nghttp3_conn*conn,
2964+
uint32_tflags, int64_tstream_id,
2965+
uint64_trx_app_error_code,
2966+
uint64_ttx_app_error_code);
2967+
28452968
/**
28462969
* @macrosection
28472970
*

β€Ž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-
#defineNGHTTP3_VERSION "1.17.0"
34+
#defineNGHTTP3_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-
#defineNGHTTP3_VERSION_NUM0x011100
44+
#defineNGHTTP3_VERSION_NUM0x011200
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
caseNGHTTP3_CALLBACKS_VERSION:
6868
returnsizeof(callbacks);
69+
caseNGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
caseNGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) +sizeof(callbacks.rand);
7174
caseNGHTTP3_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
returnnread;
624624
}
625625

626-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream);
626+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
627+
uint32_tflags, uint64_trx_app_error_code,
628+
uint64_ttx_app_error_code);
627629

628630
nghttp3_ssizenghttp3_conn_read_uni(nghttp3_conn*conn, nghttp3_stream*stream,
629631
constuint8_t*src, size_tsrclen, intfin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
returnNGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
returnconn_delete_stream(conn, stream);
654+
returnconn_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-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream) {
1341+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
1342+
uint32_tflags, uint64_trx_app_error_code,
1343+
uint64_ttx_app_error_code) {
13391344
intrv;
1345+
uint64_tapp_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+
returnNGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} elseif (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
returnNGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
intnghttp3_conn_close_stream(nghttp3_conn*conn, int64_tstream_id,
27272751
uint64_tapp_error_code) {
2752+
returnnghttp3_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+
intnghttp3_conn_close_stream2(nghttp3_conn*conn, uint32_tflags,
2760+
int64_tstream_id, uint64_trx_app_error_code,
2761+
uint64_ttx_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
returnNGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

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

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

27462779
intnghttp3_conn_shutdown_stream_read(nghttp3_conn*conn, int64_tstream_id) {

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_ksl.cβ€Ž

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ static nghttp3_ksl_blk null_blk;
3737

3838
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
3939

40+
#defineNGHTTP3_KSL_ALIGNED_BLKLEN \
41+
((sizeof(nghttp3_ksl_blk) + 0x7U) & ~(size_t)0x7U)
42+
4043
staticsize_tksl_blklen(size_taligned_keylen) {
41-
returnsizeof(nghttp3_ksl_blk)+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
44+
returnNGHTTP3_KSL_ALIGNED_BLKLEN+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
4245
}
4346

4447
/*
@@ -80,7 +83,7 @@ static nghttp3_ksl_blk *ksl_blk_objalloc_new(nghttp3_ksl *ksl) {
8083
returnNULL;
8184
}
8285

83-
blk->keys= (uint8_t*)blk+sizeof(*blk);
86+
blk->keys= (uint8_t*)blk+NGHTTP3_KSL_ALIGNED_BLKLEN;
8487
blk->aligned_keylen= (uint16_t)ksl->aligned_keylen;
8588

8689
returnblk;
@@ -223,22 +226,21 @@ static int ksl_split_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i) {
223226
* Out of memory.
224227
*/
225228
staticintksl_split_root(nghttp3_ksl*ksl) {
226-
nghttp3_ksl_blk*rblk=NULL, *lblk, *nroot=NULL;
229+
nghttp3_ksl_blk*rblk, *lblk, *nroot;
230+
231+
nroot=ksl_blk_objalloc_new(ksl);
232+
if (nroot==NULL) {
233+
returnNGHTTP3_ERR_NOMEM;
234+
}
227235

228236
rblk=ksl_split_blk(ksl, ksl->root);
229237
if (rblk==NULL) {
238+
ksl_blk_objalloc_del(ksl, nroot);
230239
returnNGHTTP3_ERR_NOMEM;
231240
}
232241

233242
lblk=ksl->root;
234243

235-
nroot=ksl_blk_objalloc_new(ksl);
236-
237-
if (nroot==NULL) {
238-
ksl_blk_objalloc_del(ksl, rblk);
239-
returnNGHTTP3_ERR_NOMEM;
240-
}
241-
242244
nroot->next=nroot->prev=NULL;
243245
nroot->n=2;
244246
nroot->leaf=0;

0 commit comments

Comments
Β (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19611961
/**
19621962
* @functypedef
19631963
*
1964-
* :type:`nghttp3_conn_stream_close` is a callback function which is
1964+
* :type:`nghttp3_stream_close` is a callback function which is
19651965
* invoked when a stream identified by |stream_id| is closed. QUIC
19661966
* application error code |app_error_code| indicates the reason of
19671967
* this closure.
@@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19701970
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
19711971
* caller immediately. Any values other than 0 is treated as
19721972
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
1973+
*
1974+
* .. seealso::
1975+
* :type:`nghttp3_stream_close2`
19731976
*/
19741977
typedefint (*nghttp3_stream_close)(nghttp3_conn*conn, int64_tstream_id,
19751978
uint64_tapp_error_code,
@@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
22402243
constnghttp3_proto_settings*settings,
22412244
void*conn_user_data);
22422245

2246+
/**
2247+
* @macrosection
2248+
*
2249+
* Stream close flags
2250+
*/
2251+
2252+
/**
2253+
* @macro
2254+
*
2255+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
2256+
*
2257+
* .. version-added:: 1.18.0
2258+
*/
2259+
#defineNGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U
2260+
2261+
/**
2262+
* @macro
2263+
*
2264+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
2265+
* that rx_app_error_code parameter is set.
2266+
*
2267+
* .. version-added:: 1.18.0
2268+
*/
2269+
#defineNGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U
2270+
2271+
/**
2272+
* @macro
2273+
*
2274+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
2275+
* that tx_app_error_code parameter is set.
2276+
*
2277+
* .. version-added:: 1.18.0
2278+
*/
2279+
#defineNGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
2280+
2281+
/**
2282+
* @functypedef
2283+
*
2284+
* :type:`nghttp3_stream_close2` is a callback function which is
2285+
* invoked when a stream identified by |stream_id| is closed. If
2286+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2287+
* |flags|, |rx_app_error_code| is the QUIC application error code
2288+
* that shut down the receiving side of the stream. If
2289+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2290+
* |flags|, |tx_app_error_code| is the QUIC application error code
2291+
* that shut down the sending side of the stream. No application code
2292+
* means that direction of stream is closed without any error.
2293+
*
2294+
* This callback should be used with `nghttp3_conn_close_stream2`. If
2295+
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
2296+
* both |rx_app_error_code| and |tx_app_error_code|, and
2297+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
2298+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
2299+
* |flags|.
2300+
*
2301+
* The implementation of this callback must return 0 if it succeeds.
2302+
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2303+
* caller immediately. Any values other than 0 is treated as
2304+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
2305+
*
2306+
* .. version-added:: 1.18.0
2307+
*/
2308+
typedefint (*nghttp3_stream_close2)(nghttp3_conn*conn, uint32_tflags,
2309+
int64_tstream_id,
2310+
uint64_trx_app_error_code,
2311+
uint64_ttx_app_error_code,
2312+
void*conn_user_data,
2313+
void*stream_user_data);
2314+
22432315
#defineNGHTTP3_CALLBACKS_V1 1
22442316
#defineNGHTTP3_CALLBACKS_V2 2
22452317
#defineNGHTTP3_CALLBACKS_V3 3
2246-
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
2318+
#defineNGHTTP3_CALLBACKS_V4 4
2319+
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
22472320

22482321
/**
22492322
* @struct
@@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
22602333
/**
22612334
* :member:`stream_close` is a callback function which is invoked
22622335
* when a particular stream has closed.
2336+
*
2337+
* .. seealso::
2338+
* :member:`stream_close2`
22632339
*/
22642340
nghttp3_stream_closestream_close;
22652341
/**
@@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
23682444
* .. version-added:: 1.11.0
23692445
*/
23702446
nghttp3_randrand;
2447+
/* The following fields have been added since
2448+
NGHTTP3_CALLBACKS_V3. */
23712449
/**
23722450
* :member:`recv_settings2` is a callback function which is invoked
23732451
* when SETTINGS frame is received.
23742452
*
23752453
* .. version-added:: 1.14.0
23762454
*/
23772455
nghttp3_recv_settings2recv_settings2;
2456+
/* The following fields have been added since
2457+
NGHTTP3_CALLBACKS_V4. */
2458+
/**
2459+
* :member:`stream_close2` is a callback function which is invoked
2460+
* when a particular stream has closed.
2461+
*
2462+
* .. version-added:: 1.18.0
2463+
*/
2464+
nghttp3_stream_close2stream_close2;
23782465
} nghttp3_callbacks;
23792466

23802467
/**
@@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
28372924
* A critical stream is closed.
28382925
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
28392926
* User callback failed
2927+
*
2928+
* .. seealso::
2929+
* `nghttp3_conn_close_stream2`
28402930
*/
28412931
NGHTTP3_EXTERNintnghttp3_conn_close_stream(nghttp3_conn*conn,
28422932
int64_tstream_id,
28432933
uint64_tapp_error_code);
28442934

2935+
/**
2936+
* @function
2937+
*
2938+
* `nghttp3_conn_close_stream2` tells the library that a stream
2939+
* identified by |stream_id| has been closed. If
2940+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2941+
* |flags|, |rx_app_error_code| is the QUIC application error code
2942+
* that shut down the receiving side of the stream. Similarly,
2943+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2944+
* |flags|, |tx_app_error_code| is the QUIC application error code
2945+
* that shut down the sending side of the stream.
2946+
*
2947+
* For stream close callback, prefer
2948+
* :member:`nghttp3_callbacks.stream_close2` to
2949+
* :member:`nghttp3_callbacks.stream_close`.
2950+
*
2951+
* This function returns 0 if it succeeds, or one of the following
2952+
* negative error codes:
2953+
*
2954+
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
2955+
* Stream not found.
2956+
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
2957+
* A critical stream is closed.
2958+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2959+
* User callback failed
2960+
*
2961+
* .. version-added:: 1.18.0
2962+
*/
2963+
NGHTTP3_EXTERNintnghttp3_conn_close_stream2(nghttp3_conn*conn,
2964+
uint32_tflags, int64_tstream_id,
2965+
uint64_trx_app_error_code,
2966+
uint64_ttx_app_error_code);
2967+
28452968
/**
28462969
* @macrosection
28472970
*

β€Ž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-
#defineNGHTTP3_VERSION "1.17.0"
34+
#defineNGHTTP3_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-
#defineNGHTTP3_VERSION_NUM0x011100
44+
#defineNGHTTP3_VERSION_NUM0x011200
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
caseNGHTTP3_CALLBACKS_VERSION:
6868
returnsizeof(callbacks);
69+
caseNGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
caseNGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) +sizeof(callbacks.rand);
7174
caseNGHTTP3_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
returnnread;
624624
}
625625

626-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream);
626+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
627+
uint32_tflags, uint64_trx_app_error_code,
628+
uint64_ttx_app_error_code);
627629

628630
nghttp3_ssizenghttp3_conn_read_uni(nghttp3_conn*conn, nghttp3_stream*stream,
629631
constuint8_t*src, size_tsrclen, intfin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
returnNGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
returnconn_delete_stream(conn, stream);
654+
returnconn_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-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream) {
1341+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
1342+
uint32_tflags, uint64_trx_app_error_code,
1343+
uint64_ttx_app_error_code) {
13391344
intrv;
1345+
uint64_tapp_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+
returnNGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} elseif (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
returnNGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
intnghttp3_conn_close_stream(nghttp3_conn*conn, int64_tstream_id,
27272751
uint64_tapp_error_code) {
2752+
returnnghttp3_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+
intnghttp3_conn_close_stream2(nghttp3_conn*conn, uint32_tflags,
2760+
int64_tstream_id, uint64_trx_app_error_code,
2761+
uint64_ttx_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
returnNGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

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

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

27462779
intnghttp3_conn_shutdown_stream_read(nghttp3_conn*conn, int64_tstream_id) {

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_ksl.cβ€Ž

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ static nghttp3_ksl_blk null_blk;
3737

3838
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
3939

40+
#defineNGHTTP3_KSL_ALIGNED_BLKLEN \
41+
((sizeof(nghttp3_ksl_blk) + 0x7U) & ~(size_t)0x7U)
42+
4043
staticsize_tksl_blklen(size_taligned_keylen) {
41-
returnsizeof(nghttp3_ksl_blk)+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
44+
returnNGHTTP3_KSL_ALIGNED_BLKLEN+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
4245
}
4346

4447
/*
@@ -80,7 +83,7 @@ static nghttp3_ksl_blk *ksl_blk_objalloc_new(nghttp3_ksl *ksl) {
8083
returnNULL;
8184
}
8285

83-
blk->keys= (uint8_t*)blk+sizeof(*blk);
86+
blk->keys= (uint8_t*)blk+NGHTTP3_KSL_ALIGNED_BLKLEN;
8487
blk->aligned_keylen= (uint16_t)ksl->aligned_keylen;
8588

8689
returnblk;
@@ -223,22 +226,21 @@ static int ksl_split_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i) {
223226
* Out of memory.
224227
*/
225228
staticintksl_split_root(nghttp3_ksl*ksl) {
226-
nghttp3_ksl_blk*rblk=NULL, *lblk, *nroot=NULL;
229+
nghttp3_ksl_blk*rblk, *lblk, *nroot;
230+
231+
nroot=ksl_blk_objalloc_new(ksl);
232+
if (nroot==NULL) {
233+
returnNGHTTP3_ERR_NOMEM;
234+
}
227235

228236
rblk=ksl_split_blk(ksl, ksl->root);
229237
if (rblk==NULL) {
238+
ksl_blk_objalloc_del(ksl, nroot);
230239
returnNGHTTP3_ERR_NOMEM;
231240
}
232241

233242
lblk=ksl->root;
234243

235-
nroot=ksl_blk_objalloc_new(ksl);
236-
237-
if (nroot==NULL) {
238-
ksl_blk_objalloc_del(ksl, rblk);
239-
returnNGHTTP3_ERR_NOMEM;
240-
}
241-
242244
nroot->next=nroot->prev=NULL;
243245
nroot->n=2;
244246
nroot->leaf=0;

0 commit comments

Comments
Β (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
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
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19611961
/**
19621962
* @functypedef
19631963
*
1964-
* :type:`nghttp3_conn_stream_close` is a callback function which is
1964+
* :type:`nghttp3_stream_close` is a callback function which is
19651965
* invoked when a stream identified by |stream_id| is closed. QUIC
19661966
* application error code |app_error_code| indicates the reason of
19671967
* this closure.
@@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19701970
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
19711971
* caller immediately. Any values other than 0 is treated as
19721972
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
1973+
*
1974+
* .. seealso::
1975+
* :type:`nghttp3_stream_close2`
19731976
*/
19741977
typedefint (*nghttp3_stream_close)(nghttp3_conn*conn, int64_tstream_id,
19751978
uint64_tapp_error_code,
@@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
22402243
constnghttp3_proto_settings*settings,
22412244
void*conn_user_data);
22422245

2246+
/**
2247+
* @macrosection
2248+
*
2249+
* Stream close flags
2250+
*/
2251+
2252+
/**
2253+
* @macro
2254+
*
2255+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
2256+
*
2257+
* .. version-added:: 1.18.0
2258+
*/
2259+
#defineNGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U
2260+
2261+
/**
2262+
* @macro
2263+
*
2264+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
2265+
* that rx_app_error_code parameter is set.
2266+
*
2267+
* .. version-added:: 1.18.0
2268+
*/
2269+
#defineNGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U
2270+
2271+
/**
2272+
* @macro
2273+
*
2274+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
2275+
* that tx_app_error_code parameter is set.
2276+
*
2277+
* .. version-added:: 1.18.0
2278+
*/
2279+
#defineNGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
2280+
2281+
/**
2282+
* @functypedef
2283+
*
2284+
* :type:`nghttp3_stream_close2` is a callback function which is
2285+
* invoked when a stream identified by |stream_id| is closed. If
2286+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2287+
* |flags|, |rx_app_error_code| is the QUIC application error code
2288+
* that shut down the receiving side of the stream. If
2289+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2290+
* |flags|, |tx_app_error_code| is the QUIC application error code
2291+
* that shut down the sending side of the stream. No application code
2292+
* means that direction of stream is closed without any error.
2293+
*
2294+
* This callback should be used with `nghttp3_conn_close_stream2`. If
2295+
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
2296+
* both |rx_app_error_code| and |tx_app_error_code|, and
2297+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
2298+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
2299+
* |flags|.
2300+
*
2301+
* The implementation of this callback must return 0 if it succeeds.
2302+
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2303+
* caller immediately. Any values other than 0 is treated as
2304+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
2305+
*
2306+
* .. version-added:: 1.18.0
2307+
*/
2308+
typedefint (*nghttp3_stream_close2)(nghttp3_conn*conn, uint32_tflags,
2309+
int64_tstream_id,
2310+
uint64_trx_app_error_code,
2311+
uint64_ttx_app_error_code,
2312+
void*conn_user_data,
2313+
void*stream_user_data);
2314+
22432315
#defineNGHTTP3_CALLBACKS_V1 1
22442316
#defineNGHTTP3_CALLBACKS_V2 2
22452317
#defineNGHTTP3_CALLBACKS_V3 3
2246-
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
2318+
#defineNGHTTP3_CALLBACKS_V4 4
2319+
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
22472320

22482321
/**
22492322
* @struct
@@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
22602333
/**
22612334
* :member:`stream_close` is a callback function which is invoked
22622335
* when a particular stream has closed.
2336+
*
2337+
* .. seealso::
2338+
* :member:`stream_close2`
22632339
*/
22642340
nghttp3_stream_closestream_close;
22652341
/**
@@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
23682444
* .. version-added:: 1.11.0
23692445
*/
23702446
nghttp3_randrand;
2447+
/* The following fields have been added since
2448+
NGHTTP3_CALLBACKS_V3. */
23712449
/**
23722450
* :member:`recv_settings2` is a callback function which is invoked
23732451
* when SETTINGS frame is received.
23742452
*
23752453
* .. version-added:: 1.14.0
23762454
*/
23772455
nghttp3_recv_settings2recv_settings2;
2456+
/* The following fields have been added since
2457+
NGHTTP3_CALLBACKS_V4. */
2458+
/**
2459+
* :member:`stream_close2` is a callback function which is invoked
2460+
* when a particular stream has closed.
2461+
*
2462+
* .. version-added:: 1.18.0
2463+
*/
2464+
nghttp3_stream_close2stream_close2;
23782465
} nghttp3_callbacks;
23792466

23802467
/**
@@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
28372924
* A critical stream is closed.
28382925
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
28392926
* User callback failed
2927+
*
2928+
* .. seealso::
2929+
* `nghttp3_conn_close_stream2`
28402930
*/
28412931
NGHTTP3_EXTERNintnghttp3_conn_close_stream(nghttp3_conn*conn,
28422932
int64_tstream_id,
28432933
uint64_tapp_error_code);
28442934

2935+
/**
2936+
* @function
2937+
*
2938+
* `nghttp3_conn_close_stream2` tells the library that a stream
2939+
* identified by |stream_id| has been closed. If
2940+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2941+
* |flags|, |rx_app_error_code| is the QUIC application error code
2942+
* that shut down the receiving side of the stream. Similarly,
2943+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2944+
* |flags|, |tx_app_error_code| is the QUIC application error code
2945+
* that shut down the sending side of the stream.
2946+
*
2947+
* For stream close callback, prefer
2948+
* :member:`nghttp3_callbacks.stream_close2` to
2949+
* :member:`nghttp3_callbacks.stream_close`.
2950+
*
2951+
* This function returns 0 if it succeeds, or one of the following
2952+
* negative error codes:
2953+
*
2954+
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
2955+
* Stream not found.
2956+
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
2957+
* A critical stream is closed.
2958+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2959+
* User callback failed
2960+
*
2961+
* .. version-added:: 1.18.0
2962+
*/
2963+
NGHTTP3_EXTERNintnghttp3_conn_close_stream2(nghttp3_conn*conn,
2964+
uint32_tflags, int64_tstream_id,
2965+
uint64_trx_app_error_code,
2966+
uint64_ttx_app_error_code);
2967+
28452968
/**
28462969
* @macrosection
28472970
*

β€Ž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-
#defineNGHTTP3_VERSION "1.17.0"
34+
#defineNGHTTP3_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-
#defineNGHTTP3_VERSION_NUM0x011100
44+
#defineNGHTTP3_VERSION_NUM0x011200
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
caseNGHTTP3_CALLBACKS_VERSION:
6868
returnsizeof(callbacks);
69+
caseNGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
caseNGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) +sizeof(callbacks.rand);
7174
caseNGHTTP3_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
returnnread;
624624
}
625625

626-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream);
626+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
627+
uint32_tflags, uint64_trx_app_error_code,
628+
uint64_ttx_app_error_code);
627629

628630
nghttp3_ssizenghttp3_conn_read_uni(nghttp3_conn*conn, nghttp3_stream*stream,
629631
constuint8_t*src, size_tsrclen, intfin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
returnNGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
returnconn_delete_stream(conn, stream);
654+
returnconn_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-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream) {
1341+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
1342+
uint32_tflags, uint64_trx_app_error_code,
1343+
uint64_ttx_app_error_code) {
13391344
intrv;
1345+
uint64_tapp_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+
returnNGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} elseif (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
returnNGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
intnghttp3_conn_close_stream(nghttp3_conn*conn, int64_tstream_id,
27272751
uint64_tapp_error_code) {
2752+
returnnghttp3_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+
intnghttp3_conn_close_stream2(nghttp3_conn*conn, uint32_tflags,
2760+
int64_tstream_id, uint64_trx_app_error_code,
2761+
uint64_ttx_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
returnNGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

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

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

27462779
intnghttp3_conn_shutdown_stream_read(nghttp3_conn*conn, int64_tstream_id) {

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_ksl.cβ€Ž

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ static nghttp3_ksl_blk null_blk;
3737

3838
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
3939

40+
#defineNGHTTP3_KSL_ALIGNED_BLKLEN \
41+
((sizeof(nghttp3_ksl_blk) + 0x7U) & ~(size_t)0x7U)
42+
4043
staticsize_tksl_blklen(size_taligned_keylen) {
41-
returnsizeof(nghttp3_ksl_blk)+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
44+
returnNGHTTP3_KSL_ALIGNED_BLKLEN+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
4245
}
4346

4447
/*
@@ -80,7 +83,7 @@ static nghttp3_ksl_blk *ksl_blk_objalloc_new(nghttp3_ksl *ksl) {
8083
returnNULL;
8184
}
8285

83-
blk->keys= (uint8_t*)blk+sizeof(*blk);
86+
blk->keys= (uint8_t*)blk+NGHTTP3_KSL_ALIGNED_BLKLEN;
8487
blk->aligned_keylen= (uint16_t)ksl->aligned_keylen;
8588

8689
returnblk;
@@ -223,22 +226,21 @@ static int ksl_split_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i) {
223226
* Out of memory.
224227
*/
225228
staticintksl_split_root(nghttp3_ksl*ksl) {
226-
nghttp3_ksl_blk*rblk=NULL, *lblk, *nroot=NULL;
229+
nghttp3_ksl_blk*rblk, *lblk, *nroot;
230+
231+
nroot=ksl_blk_objalloc_new(ksl);
232+
if (nroot==NULL) {
233+
returnNGHTTP3_ERR_NOMEM;
234+
}
227235

228236
rblk=ksl_split_blk(ksl, ksl->root);
229237
if (rblk==NULL) {
238+
ksl_blk_objalloc_del(ksl, nroot);
230239
returnNGHTTP3_ERR_NOMEM;
231240
}
232241

233242
lblk=ksl->root;
234243

235-
nroot=ksl_blk_objalloc_new(ksl);
236-
237-
if (nroot==NULL) {
238-
ksl_blk_objalloc_del(ksl, rblk);
239-
returnNGHTTP3_ERR_NOMEM;
240-
}
241-
242244
nroot->next=nroot->prev=NULL;
243245
nroot->n=2;
244246
nroot->leaf=0;

0 commit comments

Comments
Β (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19611961
/**
19621962
* @functypedef
19631963
*
1964-
* :type:`nghttp3_conn_stream_close` is a callback function which is
1964+
* :type:`nghttp3_stream_close` is a callback function which is
19651965
* invoked when a stream identified by |stream_id| is closed. QUIC
19661966
* application error code |app_error_code| indicates the reason of
19671967
* this closure.
@@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19701970
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
19711971
* caller immediately. Any values other than 0 is treated as
19721972
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
1973+
*
1974+
* .. seealso::
1975+
* :type:`nghttp3_stream_close2`
19731976
*/
19741977
typedefint (*nghttp3_stream_close)(nghttp3_conn*conn, int64_tstream_id,
19751978
uint64_tapp_error_code,
@@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
22402243
constnghttp3_proto_settings*settings,
22412244
void*conn_user_data);
22422245

2246+
/**
2247+
* @macrosection
2248+
*
2249+
* Stream close flags
2250+
*/
2251+
2252+
/**
2253+
* @macro
2254+
*
2255+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
2256+
*
2257+
* .. version-added:: 1.18.0
2258+
*/
2259+
#defineNGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U
2260+
2261+
/**
2262+
* @macro
2263+
*
2264+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
2265+
* that rx_app_error_code parameter is set.
2266+
*
2267+
* .. version-added:: 1.18.0
2268+
*/
2269+
#defineNGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U
2270+
2271+
/**
2272+
* @macro
2273+
*
2274+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
2275+
* that tx_app_error_code parameter is set.
2276+
*
2277+
* .. version-added:: 1.18.0
2278+
*/
2279+
#defineNGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
2280+
2281+
/**
2282+
* @functypedef
2283+
*
2284+
* :type:`nghttp3_stream_close2` is a callback function which is
2285+
* invoked when a stream identified by |stream_id| is closed. If
2286+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2287+
* |flags|, |rx_app_error_code| is the QUIC application error code
2288+
* that shut down the receiving side of the stream. If
2289+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2290+
* |flags|, |tx_app_error_code| is the QUIC application error code
2291+
* that shut down the sending side of the stream. No application code
2292+
* means that direction of stream is closed without any error.
2293+
*
2294+
* This callback should be used with `nghttp3_conn_close_stream2`. If
2295+
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
2296+
* both |rx_app_error_code| and |tx_app_error_code|, and
2297+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
2298+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
2299+
* |flags|.
2300+
*
2301+
* The implementation of this callback must return 0 if it succeeds.
2302+
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2303+
* caller immediately. Any values other than 0 is treated as
2304+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
2305+
*
2306+
* .. version-added:: 1.18.0
2307+
*/
2308+
typedefint (*nghttp3_stream_close2)(nghttp3_conn*conn, uint32_tflags,
2309+
int64_tstream_id,
2310+
uint64_trx_app_error_code,
2311+
uint64_ttx_app_error_code,
2312+
void*conn_user_data,
2313+
void*stream_user_data);
2314+
22432315
#defineNGHTTP3_CALLBACKS_V1 1
22442316
#defineNGHTTP3_CALLBACKS_V2 2
22452317
#defineNGHTTP3_CALLBACKS_V3 3
2246-
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
2318+
#defineNGHTTP3_CALLBACKS_V4 4
2319+
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
22472320

22482321
/**
22492322
* @struct
@@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
22602333
/**
22612334
* :member:`stream_close` is a callback function which is invoked
22622335
* when a particular stream has closed.
2336+
*
2337+
* .. seealso::
2338+
* :member:`stream_close2`
22632339
*/
22642340
nghttp3_stream_closestream_close;
22652341
/**
@@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
23682444
* .. version-added:: 1.11.0
23692445
*/
23702446
nghttp3_randrand;
2447+
/* The following fields have been added since
2448+
NGHTTP3_CALLBACKS_V3. */
23712449
/**
23722450
* :member:`recv_settings2` is a callback function which is invoked
23732451
* when SETTINGS frame is received.
23742452
*
23752453
* .. version-added:: 1.14.0
23762454
*/
23772455
nghttp3_recv_settings2recv_settings2;
2456+
/* The following fields have been added since
2457+
NGHTTP3_CALLBACKS_V4. */
2458+
/**
2459+
* :member:`stream_close2` is a callback function which is invoked
2460+
* when a particular stream has closed.
2461+
*
2462+
* .. version-added:: 1.18.0
2463+
*/
2464+
nghttp3_stream_close2stream_close2;
23782465
} nghttp3_callbacks;
23792466

23802467
/**
@@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
28372924
* A critical stream is closed.
28382925
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
28392926
* User callback failed
2927+
*
2928+
* .. seealso::
2929+
* `nghttp3_conn_close_stream2`
28402930
*/
28412931
NGHTTP3_EXTERNintnghttp3_conn_close_stream(nghttp3_conn*conn,
28422932
int64_tstream_id,
28432933
uint64_tapp_error_code);
28442934

2935+
/**
2936+
* @function
2937+
*
2938+
* `nghttp3_conn_close_stream2` tells the library that a stream
2939+
* identified by |stream_id| has been closed. If
2940+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2941+
* |flags|, |rx_app_error_code| is the QUIC application error code
2942+
* that shut down the receiving side of the stream. Similarly,
2943+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2944+
* |flags|, |tx_app_error_code| is the QUIC application error code
2945+
* that shut down the sending side of the stream.
2946+
*
2947+
* For stream close callback, prefer
2948+
* :member:`nghttp3_callbacks.stream_close2` to
2949+
* :member:`nghttp3_callbacks.stream_close`.
2950+
*
2951+
* This function returns 0 if it succeeds, or one of the following
2952+
* negative error codes:
2953+
*
2954+
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
2955+
* Stream not found.
2956+
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
2957+
* A critical stream is closed.
2958+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2959+
* User callback failed
2960+
*
2961+
* .. version-added:: 1.18.0
2962+
*/
2963+
NGHTTP3_EXTERNintnghttp3_conn_close_stream2(nghttp3_conn*conn,
2964+
uint32_tflags, int64_tstream_id,
2965+
uint64_trx_app_error_code,
2966+
uint64_ttx_app_error_code);
2967+
28452968
/**
28462969
* @macrosection
28472970
*

β€Ž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-
#defineNGHTTP3_VERSION "1.17.0"
34+
#defineNGHTTP3_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-
#defineNGHTTP3_VERSION_NUM0x011100
44+
#defineNGHTTP3_VERSION_NUM0x011200
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
caseNGHTTP3_CALLBACKS_VERSION:
6868
returnsizeof(callbacks);
69+
caseNGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
caseNGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) +sizeof(callbacks.rand);
7174
caseNGHTTP3_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
returnnread;
624624
}
625625

626-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream);
626+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
627+
uint32_tflags, uint64_trx_app_error_code,
628+
uint64_ttx_app_error_code);
627629

628630
nghttp3_ssizenghttp3_conn_read_uni(nghttp3_conn*conn, nghttp3_stream*stream,
629631
constuint8_t*src, size_tsrclen, intfin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
returnNGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
returnconn_delete_stream(conn, stream);
654+
returnconn_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-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream) {
1341+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
1342+
uint32_tflags, uint64_trx_app_error_code,
1343+
uint64_ttx_app_error_code) {
13391344
intrv;
1345+
uint64_tapp_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+
returnNGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} elseif (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
returnNGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
intnghttp3_conn_close_stream(nghttp3_conn*conn, int64_tstream_id,
27272751
uint64_tapp_error_code) {
2752+
returnnghttp3_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+
intnghttp3_conn_close_stream2(nghttp3_conn*conn, uint32_tflags,
2760+
int64_tstream_id, uint64_trx_app_error_code,
2761+
uint64_ttx_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
returnNGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

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

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

27462779
intnghttp3_conn_shutdown_stream_read(nghttp3_conn*conn, int64_tstream_id) {

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_ksl.cβ€Ž

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ static nghttp3_ksl_blk null_blk;
3737

3838
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
3939

40+
#defineNGHTTP3_KSL_ALIGNED_BLKLEN \
41+
((sizeof(nghttp3_ksl_blk) + 0x7U) & ~(size_t)0x7U)
42+
4043
staticsize_tksl_blklen(size_taligned_keylen) {
41-
returnsizeof(nghttp3_ksl_blk)+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
44+
returnNGHTTP3_KSL_ALIGNED_BLKLEN+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
4245
}
4346

4447
/*
@@ -80,7 +83,7 @@ static nghttp3_ksl_blk *ksl_blk_objalloc_new(nghttp3_ksl *ksl) {
8083
returnNULL;
8184
}
8285

83-
blk->keys= (uint8_t*)blk+sizeof(*blk);
86+
blk->keys= (uint8_t*)blk+NGHTTP3_KSL_ALIGNED_BLKLEN;
8487
blk->aligned_keylen= (uint16_t)ksl->aligned_keylen;
8588

8689
returnblk;
@@ -223,22 +226,21 @@ static int ksl_split_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i) {
223226
* Out of memory.
224227
*/
225228
staticintksl_split_root(nghttp3_ksl*ksl) {
226-
nghttp3_ksl_blk*rblk=NULL, *lblk, *nroot=NULL;
229+
nghttp3_ksl_blk*rblk, *lblk, *nroot;
230+
231+
nroot=ksl_blk_objalloc_new(ksl);
232+
if (nroot==NULL) {
233+
returnNGHTTP3_ERR_NOMEM;
234+
}
227235

228236
rblk=ksl_split_blk(ksl, ksl->root);
229237
if (rblk==NULL) {
238+
ksl_blk_objalloc_del(ksl, nroot);
230239
returnNGHTTP3_ERR_NOMEM;
231240
}
232241

233242
lblk=ksl->root;
234243

235-
nroot=ksl_blk_objalloc_new(ksl);
236-
237-
if (nroot==NULL) {
238-
ksl_blk_objalloc_del(ksl, rblk);
239-
returnNGHTTP3_ERR_NOMEM;
240-
}
241-
242244
nroot->next=nroot->prev=NULL;
243245
nroot->n=2;
244246
nroot->leaf=0;

0 commit comments

Comments
Β (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19611961
/**
19621962
* @functypedef
19631963
*
1964-
* :type:`nghttp3_conn_stream_close` is a callback function which is
1964+
* :type:`nghttp3_stream_close` is a callback function which is
19651965
* invoked when a stream identified by |stream_id| is closed. QUIC
19661966
* application error code |app_error_code| indicates the reason of
19671967
* this closure.
@@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19701970
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
19711971
* caller immediately. Any values other than 0 is treated as
19721972
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
1973+
*
1974+
* .. seealso::
1975+
* :type:`nghttp3_stream_close2`
19731976
*/
19741977
typedefint (*nghttp3_stream_close)(nghttp3_conn*conn, int64_tstream_id,
19751978
uint64_tapp_error_code,
@@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
22402243
constnghttp3_proto_settings*settings,
22412244
void*conn_user_data);
22422245

2246+
/**
2247+
* @macrosection
2248+
*
2249+
* Stream close flags
2250+
*/
2251+
2252+
/**
2253+
* @macro
2254+
*
2255+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
2256+
*
2257+
* .. version-added:: 1.18.0
2258+
*/
2259+
#defineNGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U
2260+
2261+
/**
2262+
* @macro
2263+
*
2264+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
2265+
* that rx_app_error_code parameter is set.
2266+
*
2267+
* .. version-added:: 1.18.0
2268+
*/
2269+
#defineNGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U
2270+
2271+
/**
2272+
* @macro
2273+
*
2274+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
2275+
* that tx_app_error_code parameter is set.
2276+
*
2277+
* .. version-added:: 1.18.0
2278+
*/
2279+
#defineNGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
2280+
2281+
/**
2282+
* @functypedef
2283+
*
2284+
* :type:`nghttp3_stream_close2` is a callback function which is
2285+
* invoked when a stream identified by |stream_id| is closed. If
2286+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2287+
* |flags|, |rx_app_error_code| is the QUIC application error code
2288+
* that shut down the receiving side of the stream. If
2289+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2290+
* |flags|, |tx_app_error_code| is the QUIC application error code
2291+
* that shut down the sending side of the stream. No application code
2292+
* means that direction of stream is closed without any error.
2293+
*
2294+
* This callback should be used with `nghttp3_conn_close_stream2`. If
2295+
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
2296+
* both |rx_app_error_code| and |tx_app_error_code|, and
2297+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
2298+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
2299+
* |flags|.
2300+
*
2301+
* The implementation of this callback must return 0 if it succeeds.
2302+
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2303+
* caller immediately. Any values other than 0 is treated as
2304+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
2305+
*
2306+
* .. version-added:: 1.18.0
2307+
*/
2308+
typedefint (*nghttp3_stream_close2)(nghttp3_conn*conn, uint32_tflags,
2309+
int64_tstream_id,
2310+
uint64_trx_app_error_code,
2311+
uint64_ttx_app_error_code,
2312+
void*conn_user_data,
2313+
void*stream_user_data);
2314+
22432315
#defineNGHTTP3_CALLBACKS_V1 1
22442316
#defineNGHTTP3_CALLBACKS_V2 2
22452317
#defineNGHTTP3_CALLBACKS_V3 3
2246-
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
2318+
#defineNGHTTP3_CALLBACKS_V4 4
2319+
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
22472320

22482321
/**
22492322
* @struct
@@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
22602333
/**
22612334
* :member:`stream_close` is a callback function which is invoked
22622335
* when a particular stream has closed.
2336+
*
2337+
* .. seealso::
2338+
* :member:`stream_close2`
22632339
*/
22642340
nghttp3_stream_closestream_close;
22652341
/**
@@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
23682444
* .. version-added:: 1.11.0
23692445
*/
23702446
nghttp3_randrand;
2447+
/* The following fields have been added since
2448+
NGHTTP3_CALLBACKS_V3. */
23712449
/**
23722450
* :member:`recv_settings2` is a callback function which is invoked
23732451
* when SETTINGS frame is received.
23742452
*
23752453
* .. version-added:: 1.14.0
23762454
*/
23772455
nghttp3_recv_settings2recv_settings2;
2456+
/* The following fields have been added since
2457+
NGHTTP3_CALLBACKS_V4. */
2458+
/**
2459+
* :member:`stream_close2` is a callback function which is invoked
2460+
* when a particular stream has closed.
2461+
*
2462+
* .. version-added:: 1.18.0
2463+
*/
2464+
nghttp3_stream_close2stream_close2;
23782465
} nghttp3_callbacks;
23792466

23802467
/**
@@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
28372924
* A critical stream is closed.
28382925
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
28392926
* User callback failed
2927+
*
2928+
* .. seealso::
2929+
* `nghttp3_conn_close_stream2`
28402930
*/
28412931
NGHTTP3_EXTERNintnghttp3_conn_close_stream(nghttp3_conn*conn,
28422932
int64_tstream_id,
28432933
uint64_tapp_error_code);
28442934

2935+
/**
2936+
* @function
2937+
*
2938+
* `nghttp3_conn_close_stream2` tells the library that a stream
2939+
* identified by |stream_id| has been closed. If
2940+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2941+
* |flags|, |rx_app_error_code| is the QUIC application error code
2942+
* that shut down the receiving side of the stream. Similarly,
2943+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2944+
* |flags|, |tx_app_error_code| is the QUIC application error code
2945+
* that shut down the sending side of the stream.
2946+
*
2947+
* For stream close callback, prefer
2948+
* :member:`nghttp3_callbacks.stream_close2` to
2949+
* :member:`nghttp3_callbacks.stream_close`.
2950+
*
2951+
* This function returns 0 if it succeeds, or one of the following
2952+
* negative error codes:
2953+
*
2954+
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
2955+
* Stream not found.
2956+
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
2957+
* A critical stream is closed.
2958+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2959+
* User callback failed
2960+
*
2961+
* .. version-added:: 1.18.0
2962+
*/
2963+
NGHTTP3_EXTERNintnghttp3_conn_close_stream2(nghttp3_conn*conn,
2964+
uint32_tflags, int64_tstream_id,
2965+
uint64_trx_app_error_code,
2966+
uint64_ttx_app_error_code);
2967+
28452968
/**
28462969
* @macrosection
28472970
*

β€Ž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-
#defineNGHTTP3_VERSION "1.17.0"
34+
#defineNGHTTP3_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-
#defineNGHTTP3_VERSION_NUM0x011100
44+
#defineNGHTTP3_VERSION_NUM0x011200
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
caseNGHTTP3_CALLBACKS_VERSION:
6868
returnsizeof(callbacks);
69+
caseNGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
caseNGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) +sizeof(callbacks.rand);
7174
caseNGHTTP3_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
returnnread;
624624
}
625625

626-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream);
626+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
627+
uint32_tflags, uint64_trx_app_error_code,
628+
uint64_ttx_app_error_code);
627629

628630
nghttp3_ssizenghttp3_conn_read_uni(nghttp3_conn*conn, nghttp3_stream*stream,
629631
constuint8_t*src, size_tsrclen, intfin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
returnNGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
returnconn_delete_stream(conn, stream);
654+
returnconn_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-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream) {
1341+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
1342+
uint32_tflags, uint64_trx_app_error_code,
1343+
uint64_ttx_app_error_code) {
13391344
intrv;
1345+
uint64_tapp_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+
returnNGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} elseif (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
returnNGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
intnghttp3_conn_close_stream(nghttp3_conn*conn, int64_tstream_id,
27272751
uint64_tapp_error_code) {
2752+
returnnghttp3_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+
intnghttp3_conn_close_stream2(nghttp3_conn*conn, uint32_tflags,
2760+
int64_tstream_id, uint64_trx_app_error_code,
2761+
uint64_ttx_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
returnNGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

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

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

27462779
intnghttp3_conn_shutdown_stream_read(nghttp3_conn*conn, int64_tstream_id) {

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_ksl.cβ€Ž

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ static nghttp3_ksl_blk null_blk;
3737

3838
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
3939

40+
#defineNGHTTP3_KSL_ALIGNED_BLKLEN \
41+
((sizeof(nghttp3_ksl_blk) + 0x7U) & ~(size_t)0x7U)
42+
4043
staticsize_tksl_blklen(size_taligned_keylen) {
41-
returnsizeof(nghttp3_ksl_blk)+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
44+
returnNGHTTP3_KSL_ALIGNED_BLKLEN+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
4245
}
4346

4447
/*
@@ -80,7 +83,7 @@ static nghttp3_ksl_blk *ksl_blk_objalloc_new(nghttp3_ksl *ksl) {
8083
returnNULL;
8184
}
8285

83-
blk->keys= (uint8_t*)blk+sizeof(*blk);
86+
blk->keys= (uint8_t*)blk+NGHTTP3_KSL_ALIGNED_BLKLEN;
8487
blk->aligned_keylen= (uint16_t)ksl->aligned_keylen;
8588

8689
returnblk;
@@ -223,22 +226,21 @@ static int ksl_split_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i) {
223226
* Out of memory.
224227
*/
225228
staticintksl_split_root(nghttp3_ksl*ksl) {
226-
nghttp3_ksl_blk*rblk=NULL, *lblk, *nroot=NULL;
229+
nghttp3_ksl_blk*rblk, *lblk, *nroot;
230+
231+
nroot=ksl_blk_objalloc_new(ksl);
232+
if (nroot==NULL) {
233+
returnNGHTTP3_ERR_NOMEM;
234+
}
227235

228236
rblk=ksl_split_blk(ksl, ksl->root);
229237
if (rblk==NULL) {
238+
ksl_blk_objalloc_del(ksl, nroot);
230239
returnNGHTTP3_ERR_NOMEM;
231240
}
232241

233242
lblk=ksl->root;
234243

235-
nroot=ksl_blk_objalloc_new(ksl);
236-
237-
if (nroot==NULL) {
238-
ksl_blk_objalloc_del(ksl, rblk);
239-
returnNGHTTP3_ERR_NOMEM;
240-
}
241-
242244
nroot->next=nroot->prev=NULL;
243245
nroot->n=2;
244246
nroot->leaf=0;

0 commit comments

Comments
Β (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
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
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19611961
/**
19621962
* @functypedef
19631963
*
1964-
* :type:`nghttp3_conn_stream_close` is a callback function which is
1964+
* :type:`nghttp3_stream_close` is a callback function which is
19651965
* invoked when a stream identified by |stream_id| is closed. QUIC
19661966
* application error code |app_error_code| indicates the reason of
19671967
* this closure.
@@ -1970,6 +1970,9 @@ typedef int (*nghttp3_acked_stream_data)(nghttp3_conn *conn, int64_t stream_id,
19701970
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
19711971
* caller immediately. Any values other than 0 is treated as
19721972
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
1973+
*
1974+
* .. seealso::
1975+
* :type:`nghttp3_stream_close2`
19731976
*/
19741977
typedefint (*nghttp3_stream_close)(nghttp3_conn*conn, int64_tstream_id,
19751978
uint64_tapp_error_code,
@@ -2240,10 +2243,80 @@ typedef int (*nghttp3_recv_settings2)(nghttp3_conn *conn,
22402243
constnghttp3_proto_settings*settings,
22412244
void*conn_user_data);
22422245

2246+
/**
2247+
* @macrosection
2248+
*
2249+
* Stream close flags
2250+
*/
2251+
2252+
/**
2253+
* @macro
2254+
*
2255+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_NONE` indicates no flag set.
2256+
*
2257+
* .. version-added:: 1.18.0
2258+
*/
2259+
#defineNGHTTP3_STREAM_CLOSE_FLAG_NONE 0x00U
2260+
2261+
/**
2262+
* @macro
2263+
*
2264+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` indicates
2265+
* that rx_app_error_code parameter is set.
2266+
*
2267+
* .. version-added:: 1.18.0
2268+
*/
2269+
#defineNGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET 0x01U
2270+
2271+
/**
2272+
* @macro
2273+
*
2274+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` indicates
2275+
* that tx_app_error_code parameter is set.
2276+
*
2277+
* .. version-added:: 1.18.0
2278+
*/
2279+
#defineNGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET 0x02U
2280+
2281+
/**
2282+
* @functypedef
2283+
*
2284+
* :type:`nghttp3_stream_close2` is a callback function which is
2285+
* invoked when a stream identified by |stream_id| is closed. If
2286+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2287+
* |flags|, |rx_app_error_code| is the QUIC application error code
2288+
* that shut down the receiving side of the stream. If
2289+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2290+
* |flags|, |tx_app_error_code| is the QUIC application error code
2291+
* that shut down the sending side of the stream. No application code
2292+
* means that direction of stream is closed without any error.
2293+
*
2294+
* This callback should be used with `nghttp3_conn_close_stream2`. If
2295+
* `nghttp3_conn_close_stream` is used, the app_error_code is set to
2296+
* both |rx_app_error_code| and |tx_app_error_code|, and
2297+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` and
2298+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` are set in
2299+
* |flags|.
2300+
*
2301+
* The implementation of this callback must return 0 if it succeeds.
2302+
* Returning :macro:`NGHTTP3_ERR_CALLBACK_FAILURE` will return to the
2303+
* caller immediately. Any values other than 0 is treated as
2304+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`.
2305+
*
2306+
* .. version-added:: 1.18.0
2307+
*/
2308+
typedefint (*nghttp3_stream_close2)(nghttp3_conn*conn, uint32_tflags,
2309+
int64_tstream_id,
2310+
uint64_trx_app_error_code,
2311+
uint64_ttx_app_error_code,
2312+
void*conn_user_data,
2313+
void*stream_user_data);
2314+
22432315
#defineNGHTTP3_CALLBACKS_V1 1
22442316
#defineNGHTTP3_CALLBACKS_V2 2
22452317
#defineNGHTTP3_CALLBACKS_V3 3
2246-
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V3
2318+
#defineNGHTTP3_CALLBACKS_V4 4
2319+
#defineNGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V4
22472320

22482321
/**
22492322
* @struct
@@ -2260,6 +2333,9 @@ typedef struct nghttp3_callbacks {
22602333
/**
22612334
* :member:`stream_close` is a callback function which is invoked
22622335
* when a particular stream has closed.
2336+
*
2337+
* .. seealso::
2338+
* :member:`stream_close2`
22632339
*/
22642340
nghttp3_stream_closestream_close;
22652341
/**
@@ -2368,13 +2444,24 @@ typedef struct nghttp3_callbacks {
23682444
* .. version-added:: 1.11.0
23692445
*/
23702446
nghttp3_randrand;
2447+
/* The following fields have been added since
2448+
NGHTTP3_CALLBACKS_V3. */
23712449
/**
23722450
* :member:`recv_settings2` is a callback function which is invoked
23732451
* when SETTINGS frame is received.
23742452
*
23752453
* .. version-added:: 1.14.0
23762454
*/
23772455
nghttp3_recv_settings2recv_settings2;
2456+
/* The following fields have been added since
2457+
NGHTTP3_CALLBACKS_V4. */
2458+
/**
2459+
* :member:`stream_close2` is a callback function which is invoked
2460+
* when a particular stream has closed.
2461+
*
2462+
* .. version-added:: 1.18.0
2463+
*/
2464+
nghttp3_stream_close2stream_close2;
23782465
} nghttp3_callbacks;
23792466

23802467
/**
@@ -2837,11 +2924,47 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
28372924
* A critical stream is closed.
28382925
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
28392926
* User callback failed
2927+
*
2928+
* .. seealso::
2929+
* `nghttp3_conn_close_stream2`
28402930
*/
28412931
NGHTTP3_EXTERNintnghttp3_conn_close_stream(nghttp3_conn*conn,
28422932
int64_tstream_id,
28432933
uint64_tapp_error_code);
28442934

2935+
/**
2936+
* @function
2937+
*
2938+
* `nghttp3_conn_close_stream2` tells the library that a stream
2939+
* identified by |stream_id| has been closed. If
2940+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_RX_APP_ERROR_CODE_SET` is set in
2941+
* |flags|, |rx_app_error_code| is the QUIC application error code
2942+
* that shut down the receiving side of the stream. Similarly,
2943+
* :macro:`NGHTTP3_STREAM_CLOSE_FLAG_TX_APP_ERROR_CODE_SET` is set in
2944+
* |flags|, |tx_app_error_code| is the QUIC application error code
2945+
* that shut down the sending side of the stream.
2946+
*
2947+
* For stream close callback, prefer
2948+
* :member:`nghttp3_callbacks.stream_close2` to
2949+
* :member:`nghttp3_callbacks.stream_close`.
2950+
*
2951+
* This function returns 0 if it succeeds, or one of the following
2952+
* negative error codes:
2953+
*
2954+
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
2955+
* Stream not found.
2956+
* :macro:`NGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM`
2957+
* A critical stream is closed.
2958+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2959+
* User callback failed
2960+
*
2961+
* .. version-added:: 1.18.0
2962+
*/
2963+
NGHTTP3_EXTERNintnghttp3_conn_close_stream2(nghttp3_conn*conn,
2964+
uint32_tflags, int64_tstream_id,
2965+
uint64_trx_app_error_code,
2966+
uint64_ttx_app_error_code);
2967+
28452968
/**
28462969
* @macrosection
28472970
*

β€Ž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-
#defineNGHTTP3_VERSION "1.17.0"
34+
#defineNGHTTP3_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-
#defineNGHTTP3_VERSION_NUM0x011100
44+
#defineNGHTTP3_VERSION_NUM0x011200
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
caseNGHTTP3_CALLBACKS_VERSION:
6868
returnsizeof(callbacks);
69+
caseNGHTTP3_CALLBACKS_V3:
70+
return offsetof(nghttp3_callbacks, recv_settings2) +
71+
sizeof(callbacks.recv_settings2);
6972
caseNGHTTP3_CALLBACKS_V2:
7073
return offsetof(nghttp3_callbacks, rand) +sizeof(callbacks.rand);
7174
caseNGHTTP3_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
returnnread;
624624
}
625625

626-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream);
626+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
627+
uint32_tflags, uint64_trx_app_error_code,
628+
uint64_ttx_app_error_code);
627629

628630
nghttp3_ssizenghttp3_conn_read_uni(nghttp3_conn*conn, nghttp3_stream*stream,
629631
constuint8_t*src, size_tsrclen, intfin,
@@ -649,7 +651,8 @@ nghttp3_ssize nghttp3_conn_read_uni(nghttp3_conn *conn, nghttp3_stream *stream,
649651
returnNGHTTP3_ERR_H3_EXCESSIVE_LOAD;
650652
}
651653

652-
returnconn_delete_stream(conn, stream);
654+
returnconn_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-
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream) {
1341+
staticintconn_delete_stream(nghttp3_conn*conn, nghttp3_stream*stream,
1342+
uint32_tflags, uint64_trx_app_error_code,
1343+
uint64_ttx_app_error_code) {
13391344
intrv;
1345+
uint64_tapp_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+
returnNGHTTP3_ERR_CALLBACK_FAILURE;
1368+
}
1369+
} elseif (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
returnNGHTTP3_ERR_CALLBACK_FAILURE;
@@ -2725,6 +2749,16 @@ int nghttp3_conn_resume_stream(nghttp3_conn *conn, int64_t stream_id) {
27252749

27262750
intnghttp3_conn_close_stream(nghttp3_conn*conn, int64_tstream_id,
27272751
uint64_tapp_error_code) {
2752+
returnnghttp3_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+
intnghttp3_conn_close_stream2(nghttp3_conn*conn, uint32_tflags,
2760+
int64_tstream_id, uint64_trx_app_error_code,
2761+
uint64_ttx_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
returnNGHTTP3_ERR_H3_CLOSED_CRITICAL_STREAM;
27372771
}
27382772

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

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

27462779
intnghttp3_conn_shutdown_stream_read(nghttp3_conn*conn, int64_tstream_id) {

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_ksl.cβ€Ž

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ static nghttp3_ksl_blk null_blk;
3737

3838
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
3939

40+
#defineNGHTTP3_KSL_ALIGNED_BLKLEN \
41+
((sizeof(nghttp3_ksl_blk) + 0x7U) & ~(size_t)0x7U)
42+
4043
staticsize_tksl_blklen(size_taligned_keylen) {
41-
returnsizeof(nghttp3_ksl_blk)+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
44+
returnNGHTTP3_KSL_ALIGNED_BLKLEN+NGHTTP3_KSL_MAX_NBLK*aligned_keylen;
4245
}
4346

4447
/*
@@ -80,7 +83,7 @@ static nghttp3_ksl_blk *ksl_blk_objalloc_new(nghttp3_ksl *ksl) {
8083
returnNULL;
8184
}
8285

83-
blk->keys= (uint8_t*)blk+sizeof(*blk);
86+
blk->keys= (uint8_t*)blk+NGHTTP3_KSL_ALIGNED_BLKLEN;
8487
blk->aligned_keylen= (uint16_t)ksl->aligned_keylen;
8588

8689
returnblk;
@@ -223,22 +226,21 @@ static int ksl_split_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i) {
223226
* Out of memory.
224227
*/
225228
staticintksl_split_root(nghttp3_ksl*ksl) {
226-
nghttp3_ksl_blk*rblk=NULL, *lblk, *nroot=NULL;
229+
nghttp3_ksl_blk*rblk, *lblk, *nroot;
230+
231+
nroot=ksl_blk_objalloc_new(ksl);
232+
if (nroot==NULL) {
233+
returnNGHTTP3_ERR_NOMEM;
234+
}
227235

228236
rblk=ksl_split_blk(ksl, ksl->root);
229237
if (rblk==NULL) {
238+
ksl_blk_objalloc_del(ksl, nroot);
230239
returnNGHTTP3_ERR_NOMEM;
231240
}
232241

233242
lblk=ksl->root;
234243

235-
nroot=ksl_blk_objalloc_new(ksl);
236-
237-
if (nroot==NULL) {
238-
ksl_blk_objalloc_del(ksl, rblk);
239-
returnNGHTTP3_ERR_NOMEM;
240-
}
241-
242244
nroot->next=nroot->prev=NULL;
243245
nroot->n=2;
244246
nroot->leaf=0;

0 commit comments

Comments
Β (0)