Commit e3304cd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.17.0
PR-URL: #64182 Backport-PR-URL: #64675 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 345d6ad commit e3304cd

13 files changed

Lines changed: 4351 additions & 4265 deletions

β€Ždeps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.hβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,25 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
26252625
NGHTTP3_EXTERNintnghttp3_conn_add_write_offset(nghttp3_conn*conn,
26262626
int64_tstream_id, size_tn);
26272627

2628+
/**
2629+
* @function
2630+
*
2631+
* `nghttp3_conn_is_stream_flushed` returns nonzero if all stream data
2632+
* for a stream identified by |stream_id| so far have been accepted by
2633+
* QUIC stack. This means that the cumulative number of bytes that
2634+
* `nghttp3_conn_add_write_offset` notified covers all stream data
2635+
* currently held. This does not mean more stream data cannot be
2636+
* submitted to this stream via :type:`nghttp3_read_data_callback` and
2637+
* all stream data have been acknowledged.
2638+
*
2639+
* If there is no stream identified by |stream_id|, this function
2640+
* returns nonzero.
2641+
*
2642+
* .. version-added:: 1.17.0
2643+
*/
2644+
NGHTTP3_EXTERNintnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2645+
int64_tstream_id);
2646+
26282647
/**
26292648
* @function
26302649
*
@@ -3418,6 +3437,75 @@ NGHTTP3_EXTERN const nghttp3_info *nghttp3_version(int least_version);
34183437
*/
34193438
NGHTTP3_EXTERNintnghttp3_err_is_fatal(intliberr);
34203439

3440+
/**
3441+
* @function
3442+
*
3443+
* `nghttp3_get_uvarint` reads variable-length unsigned integer from
3444+
* the buffer pointed by |p|, and stores it in the object pointed by
3445+
* |dest| in host byte order. It returns |p| plus the number of bytes
3446+
* read from |p|. This function assumes that |p| points to the buffer
3447+
* that contains a valid variable-length unsigned integer. Use
3448+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3449+
* decode an integer.
3450+
*
3451+
* .. version-added:: 1.17.0
3452+
*/
3453+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_uvarint(uint64_t*dest,
3454+
constuint8_t*p);
3455+
3456+
/**
3457+
* @function
3458+
*
3459+
* `nghttp3_get_uvarintlen` returns the required number of bytes to
3460+
* read variable-length unsigned integer starting at |p|. |p| must
3461+
* not be NULL. This function only reads the single byte from the
3462+
* buffer pointed by |p|, and determines the number of bytes to read.
3463+
*
3464+
* .. version-added:: 1.17.0
3465+
*/
3466+
NGHTTP3_EXTERNsize_tnghttp3_get_uvarintlen(constuint8_t*p);
3467+
3468+
/**
3469+
* @function
3470+
*
3471+
* `nghttp3_get_varint` reads variable-length unsigned integer from
3472+
* the buffer pointed by |p|, and stores it in the object pointed by
3473+
* |dest| in host byte order. It returns |p| plus the number of bytes
3474+
* read from |p|. This function assumes that |p| points to the buffer
3475+
* that contains a valid variable-length unsigned integer. Use
3476+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3477+
* decode an integer.
3478+
*
3479+
* .. version-added:: 1.17.0
3480+
*/
3481+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_varint(int64_t*dest,
3482+
constuint8_t*p);
3483+
3484+
/**
3485+
* @function
3486+
*
3487+
* `nghttp3_put_uvarint` writes |n| to the buffer pointed by |p| using
3488+
* variable-length unsigned integer encoding. It returns the one
3489+
* beyond of the last written position. This function assumes that
3490+
* the buffer pointed by |p| has sufficient capacity to encode |n|.
3491+
* To know the required capacity, use `nghttp3_put_uvarintlen`. |n|
3492+
* must be less than or equal to (1 << 62) - 1.
3493+
*
3494+
* .. version-added:: 1.17.0
3495+
*/
3496+
NGHTTP3_EXTERNuint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
3497+
3498+
/**
3499+
* @function
3500+
*
3501+
* `nghttp3_put_uvarintlen` returns the required number of bytes to
3502+
* encode |n| in variable-length unsigned integer encoding. |n| must
3503+
* be less than or equal to (1 << 62) - 1.
3504+
*
3505+
* .. version-added:: 1.17.0
3506+
*/
3507+
NGHTTP3_EXTERNsize_tnghttp3_put_uvarintlen(uint64_tn);
3508+
34213509
/*
34223510
* Versioned function wrappers
34233511
*/

β€Ž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.16.0"
34+
#defineNGHTTP3_VERSION "1.17.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_NUM0x011000
44+
#defineNGHTTP3_VERSION_NUM0x011100
4545

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,3 +2979,25 @@ int nghttp3_conn_is_drained2(const nghttp3_conn *conn) {
29792979
nghttp3_stream_outq_write_done(conn->tx.ctrl) &&
29802980
nghttp3_ringbuf_len(&conn->tx.ctrl->frq) ==0;
29812981
}
2982+
2983+
intnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2984+
int64_tstream_id) {
2985+
nghttp3_stream*stream=nghttp3_conn_find_stream(conn, stream_id);
2986+
constnghttp3_frame*fr;
2987+
2988+
if (!stream) {
2989+
return1;
2990+
}
2991+
2992+
if (!nghttp3_stream_outq_write_done(stream)) {
2993+
return0;
2994+
}
2995+
2996+
if (nghttp3_ringbuf_len(&stream->frq) ==0) {
2997+
return1;
2998+
}
2999+
3000+
fr=nghttp3_ringbuf_get(&stream->frq, 0);
3001+
3002+
returnfr->hd.type==NGHTTP3_FRAME_DATA;
3003+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ size_t nghttp3_get_uvarintlen(const uint8_t *p) {
7070
return (size_t)(1U << (*p >> 6));
7171
}
7272

73+
constuint8_t*nghttp3_get_varint(int64_t*dest, constuint8_t*p) {
74+
uint64_tn;
75+
76+
p=nghttp3_get_uvarint(&n, p);
77+
*dest= (int64_t)n;
78+
79+
returnp;
80+
}
81+
7382
uint8_t*nghttp3_put_uint64be(uint8_t*p, uint64_tn) {
7483
n=nghttp3_htonl64(n);
7584
returnnghttp3_cpymem(p, (constuint8_t*)&n, sizeof(n));

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_conv.hβ€Ž

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@
9292
# definentohs(N) _byteswap_ushort(N)
9393
#endif/* defined(WIN32) */
9494

95-
/*
96-
* nghttp3_get_uvarint reads variable-length unsigned integer from
97-
* |p|, and stores it in the buffer pointed by |dest| in host byte
98-
* order. It returns |p| plus the number of bytes read from |p|.
99-
*/
100-
constuint8_t*nghttp3_get_uvarint(uint64_t*dest, constuint8_t*p);
101-
102-
/*
103-
* nghttp3_get_uvarintlen returns the required number of bytes to read
104-
* variable-length integer starting at |p|.
105-
*/
106-
size_tnghttp3_get_uvarintlen(constuint8_t*p);
107-
108-
/*
109-
* nghttp3_get_varint reads variable-length unsigned integer from |p|,
110-
* and stores it in the buffer pointed by |dest| in host byte order.
111-
* It returns |p| plus the number of bytes read from |p|.
112-
*/
113-
staticinlineconstuint8_t*nghttp3_get_varint(int64_t*dest,
114-
constuint8_t*p) {
115-
uint64_tn;
116-
117-
p=nghttp3_get_uvarint(&n, p);
118-
*dest= (int64_t)n;
119-
120-
returnp;
121-
}
122-
12395
/*
12496
* nghttp3_put_uint64be writes |n| in host byte order in |p| in
12597
* network byte order. It returns the one beyond of the last written
@@ -141,18 +113,6 @@ uint8_t *nghttp3_put_uint32be(uint8_t *p, uint32_t n);
141113
*/
142114
uint8_t*nghttp3_put_uint16be(uint8_t*p, uint16_tn);
143115

144-
/*
145-
* nghttp3_put_uvarint writes |n| in |p| using variable-length integer
146-
* encoding. It returns the one beyond of the last written position.
147-
*/
148-
uint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
149-
150-
/*
151-
* nghttp3_put_uvarintlen returns the required number of bytes to
152-
* encode |n|.
153-
*/
154-
size_tnghttp3_put_uvarintlen(uint64_tn);
155-
156116
/*
157117
* nghttp3_ord_stream_id returns the ordinal number of |stream_id|.
158118
*/

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include"nghttp3_macro.h"
3737
#include"nghttp3_conv.h"
3838
#include"nghttp3_unreachable.h"
39+
#include"nghttp3_str.h"
3940
#include"sfparse/sfparse.h"
4041

41-
staticuint8_tdowncase(uint8_tc) {
42-
return'A' <= c&&c <= 'Z' ? (uint8_t)(c-'A'+'a') : c;
43-
}
44-
4542
/*
4643
* memieq returns 1 if the data pointed by |a| of length |n| equals to
4744
* |b| of the same length in case-insensitive manner. The data
@@ -52,7 +49,7 @@ static int memieq(const void *a, const void *b, size_t n) {
5249
constuint8_t*aa=a, *bb=b;
5350

5451
for (i=0; i<n; ++i) {
55-
if (aa[i] !=downcase(bb[i])) {
52+
if (aa[i] !=nghttp3_downcase_byte(bb[i])) {
5653
return0;
5754
}
5855
}
@@ -704,7 +701,7 @@ int nghttp3_check_header_name(const uint8_t *name, size_t len) {
704701
--len;
705702
}
706703
for (last=name+len; name!=last; ++name) {
707-
if (!VALID_HD_NAME_CHARS[*name]) {
704+
if (VALID_HD_NAME_CHARS[*name]!=1) {
708705
return0;
709706
}
710707
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uint8_t *nghttp3_qpack_huffman_encode(uint8_t *dest, const uint8_t *src,
8080
voidnghttp3_qpack_huffman_decode_context_init(
8181
nghttp3_qpack_huffman_decode_context*ctx) {
8282
*ctx= (nghttp3_qpack_huffman_decode_context){
83-
.flags=NGHTTP3_QPACK_HUFFMAN_ACCEPTED,
83+
.flags=NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED,
8484
};
8585
}
8686

@@ -103,20 +103,20 @@ nghttp3_qpack_huffman_decode(nghttp3_qpack_huffman_decode_context *ctx,
103103
for (; src!=end;) {
104104
c=*src++;
105105
t=qpack_huffman_decode_table[t.fstate][c >> 4];
106-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
106+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
107107
*p++=t.sym;
108108
}
109109

110110
t=qpack_huffman_decode_table[t.fstate][c&0xFU];
111-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
111+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
112112
*p++=t.sym;
113113
}
114114
}
115115

116116
ctx->fstate=t.fstate;
117117
ctx->flags=t.flags;
118118

119-
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_ACCEPTED)) {
119+
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED)) {
120120
returnNGHTTP3_ERR_QPACK_FATAL;
121121
}
122122

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_qpack_huffman.hβ€Ž

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@ size_t nghttp3_qpack_huffman_encode_count(const uint8_t *src, size_t len);
4646
uint8_t*nghttp3_qpack_huffman_encode(uint8_t*dest, constuint8_t*src,
4747
size_tsrclen);
4848

49-
typedefenumnghttp3_qpack_huffman_decode_flag {
50-
/* FSA accepts this state as the end of huffman encoding
51-
sequence. */
52-
NGHTTP3_QPACK_HUFFMAN_ACCEPTED=1,
53-
/* This state emits symbol */
54-
NGHTTP3_QPACK_HUFFMAN_SYM=1 << 1,
55-
} nghttp3_qpack_huffman_decode_flag;
49+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED indicates that FSA accepts this
50+
state as the end of huffman encoding sequence. */
51+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED 0x01U
52+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_SYM indicates that this state emits
53+
symbol */
54+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_SYM 0x02U
5655

5756
typedefstructnghttp3_qpack_huffman_decode_node {
5857
/* fstate is the current huffman decoding state, which is actually
5958
the node ID of internal huffman tree with
60-
nghttp3_qpack_huffman_decode_flag OR-ed. We have 257 leaf nodes,
61-
but they are identical to root node other than emitting a symbol,
62-
so we have 256 internal nodes [1..256], inclusive. The node ID
63-
256 is a special node and it is a terminal state that means
64-
decoding failed. */
59+
NGHTTP3_QPACK_HUFFMAN_FLAG_* flags OR-ed. We have 257 leaf
60+
nodes, but they are identical to root node other than emitting a
61+
symbol, so we have 256 internal nodes [1..256], inclusive. The
62+
node ID 256 is a special node and it is a terminal state that
63+
means decoding failed. */
6564
uint16_tfstate;
6665
uint8_tflags;
67-
/* symbol if NGHTTP3_QPACK_HUFFMAN_SYM flag set */
66+
/* symbol if NGHTTP3_QPACK_HUFFMAN_FLAG_SYM flag set */
6867
uint8_tsym;
6968
} nghttp3_qpack_huffman_decode_node;
7069

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 e3304cd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.17.0
PR-URL: #64182 Backport-PR-URL: #64675 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 345d6ad commit e3304cd

13 files changed

Lines changed: 4351 additions & 4265 deletions

β€Ždeps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.hβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,25 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
26252625
NGHTTP3_EXTERNintnghttp3_conn_add_write_offset(nghttp3_conn*conn,
26262626
int64_tstream_id, size_tn);
26272627

2628+
/**
2629+
* @function
2630+
*
2631+
* `nghttp3_conn_is_stream_flushed` returns nonzero if all stream data
2632+
* for a stream identified by |stream_id| so far have been accepted by
2633+
* QUIC stack. This means that the cumulative number of bytes that
2634+
* `nghttp3_conn_add_write_offset` notified covers all stream data
2635+
* currently held. This does not mean more stream data cannot be
2636+
* submitted to this stream via :type:`nghttp3_read_data_callback` and
2637+
* all stream data have been acknowledged.
2638+
*
2639+
* If there is no stream identified by |stream_id|, this function
2640+
* returns nonzero.
2641+
*
2642+
* .. version-added:: 1.17.0
2643+
*/
2644+
NGHTTP3_EXTERNintnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2645+
int64_tstream_id);
2646+
26282647
/**
26292648
* @function
26302649
*
@@ -3418,6 +3437,75 @@ NGHTTP3_EXTERN const nghttp3_info *nghttp3_version(int least_version);
34183437
*/
34193438
NGHTTP3_EXTERNintnghttp3_err_is_fatal(intliberr);
34203439

3440+
/**
3441+
* @function
3442+
*
3443+
* `nghttp3_get_uvarint` reads variable-length unsigned integer from
3444+
* the buffer pointed by |p|, and stores it in the object pointed by
3445+
* |dest| in host byte order. It returns |p| plus the number of bytes
3446+
* read from |p|. This function assumes that |p| points to the buffer
3447+
* that contains a valid variable-length unsigned integer. Use
3448+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3449+
* decode an integer.
3450+
*
3451+
* .. version-added:: 1.17.0
3452+
*/
3453+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_uvarint(uint64_t*dest,
3454+
constuint8_t*p);
3455+
3456+
/**
3457+
* @function
3458+
*
3459+
* `nghttp3_get_uvarintlen` returns the required number of bytes to
3460+
* read variable-length unsigned integer starting at |p|. |p| must
3461+
* not be NULL. This function only reads the single byte from the
3462+
* buffer pointed by |p|, and determines the number of bytes to read.
3463+
*
3464+
* .. version-added:: 1.17.0
3465+
*/
3466+
NGHTTP3_EXTERNsize_tnghttp3_get_uvarintlen(constuint8_t*p);
3467+
3468+
/**
3469+
* @function
3470+
*
3471+
* `nghttp3_get_varint` reads variable-length unsigned integer from
3472+
* the buffer pointed by |p|, and stores it in the object pointed by
3473+
* |dest| in host byte order. It returns |p| plus the number of bytes
3474+
* read from |p|. This function assumes that |p| points to the buffer
3475+
* that contains a valid variable-length unsigned integer. Use
3476+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3477+
* decode an integer.
3478+
*
3479+
* .. version-added:: 1.17.0
3480+
*/
3481+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_varint(int64_t*dest,
3482+
constuint8_t*p);
3483+
3484+
/**
3485+
* @function
3486+
*
3487+
* `nghttp3_put_uvarint` writes |n| to the buffer pointed by |p| using
3488+
* variable-length unsigned integer encoding. It returns the one
3489+
* beyond of the last written position. This function assumes that
3490+
* the buffer pointed by |p| has sufficient capacity to encode |n|.
3491+
* To know the required capacity, use `nghttp3_put_uvarintlen`. |n|
3492+
* must be less than or equal to (1 << 62) - 1.
3493+
*
3494+
* .. version-added:: 1.17.0
3495+
*/
3496+
NGHTTP3_EXTERNuint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
3497+
3498+
/**
3499+
* @function
3500+
*
3501+
* `nghttp3_put_uvarintlen` returns the required number of bytes to
3502+
* encode |n| in variable-length unsigned integer encoding. |n| must
3503+
* be less than or equal to (1 << 62) - 1.
3504+
*
3505+
* .. version-added:: 1.17.0
3506+
*/
3507+
NGHTTP3_EXTERNsize_tnghttp3_put_uvarintlen(uint64_tn);
3508+
34213509
/*
34223510
* Versioned function wrappers
34233511
*/

β€Ž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.16.0"
34+
#defineNGHTTP3_VERSION "1.17.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_NUM0x011000
44+
#defineNGHTTP3_VERSION_NUM0x011100
4545

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,3 +2979,25 @@ int nghttp3_conn_is_drained2(const nghttp3_conn *conn) {
29792979
nghttp3_stream_outq_write_done(conn->tx.ctrl) &&
29802980
nghttp3_ringbuf_len(&conn->tx.ctrl->frq) ==0;
29812981
}
2982+
2983+
intnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2984+
int64_tstream_id) {
2985+
nghttp3_stream*stream=nghttp3_conn_find_stream(conn, stream_id);
2986+
constnghttp3_frame*fr;
2987+
2988+
if (!stream) {
2989+
return1;
2990+
}
2991+
2992+
if (!nghttp3_stream_outq_write_done(stream)) {
2993+
return0;
2994+
}
2995+
2996+
if (nghttp3_ringbuf_len(&stream->frq) ==0) {
2997+
return1;
2998+
}
2999+
3000+
fr=nghttp3_ringbuf_get(&stream->frq, 0);
3001+
3002+
returnfr->hd.type==NGHTTP3_FRAME_DATA;
3003+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ size_t nghttp3_get_uvarintlen(const uint8_t *p) {
7070
return (size_t)(1U << (*p >> 6));
7171
}
7272

73+
constuint8_t*nghttp3_get_varint(int64_t*dest, constuint8_t*p) {
74+
uint64_tn;
75+
76+
p=nghttp3_get_uvarint(&n, p);
77+
*dest= (int64_t)n;
78+
79+
returnp;
80+
}
81+
7382
uint8_t*nghttp3_put_uint64be(uint8_t*p, uint64_tn) {
7483
n=nghttp3_htonl64(n);
7584
returnnghttp3_cpymem(p, (constuint8_t*)&n, sizeof(n));

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_conv.hβ€Ž

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@
9292
# definentohs(N) _byteswap_ushort(N)
9393
#endif/* defined(WIN32) */
9494

95-
/*
96-
* nghttp3_get_uvarint reads variable-length unsigned integer from
97-
* |p|, and stores it in the buffer pointed by |dest| in host byte
98-
* order. It returns |p| plus the number of bytes read from |p|.
99-
*/
100-
constuint8_t*nghttp3_get_uvarint(uint64_t*dest, constuint8_t*p);
101-
102-
/*
103-
* nghttp3_get_uvarintlen returns the required number of bytes to read
104-
* variable-length integer starting at |p|.
105-
*/
106-
size_tnghttp3_get_uvarintlen(constuint8_t*p);
107-
108-
/*
109-
* nghttp3_get_varint reads variable-length unsigned integer from |p|,
110-
* and stores it in the buffer pointed by |dest| in host byte order.
111-
* It returns |p| plus the number of bytes read from |p|.
112-
*/
113-
staticinlineconstuint8_t*nghttp3_get_varint(int64_t*dest,
114-
constuint8_t*p) {
115-
uint64_tn;
116-
117-
p=nghttp3_get_uvarint(&n, p);
118-
*dest= (int64_t)n;
119-
120-
returnp;
121-
}
122-
12395
/*
12496
* nghttp3_put_uint64be writes |n| in host byte order in |p| in
12597
* network byte order. It returns the one beyond of the last written
@@ -141,18 +113,6 @@ uint8_t *nghttp3_put_uint32be(uint8_t *p, uint32_t n);
141113
*/
142114
uint8_t*nghttp3_put_uint16be(uint8_t*p, uint16_tn);
143115

144-
/*
145-
* nghttp3_put_uvarint writes |n| in |p| using variable-length integer
146-
* encoding. It returns the one beyond of the last written position.
147-
*/
148-
uint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
149-
150-
/*
151-
* nghttp3_put_uvarintlen returns the required number of bytes to
152-
* encode |n|.
153-
*/
154-
size_tnghttp3_put_uvarintlen(uint64_tn);
155-
156116
/*
157117
* nghttp3_ord_stream_id returns the ordinal number of |stream_id|.
158118
*/

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include"nghttp3_macro.h"
3737
#include"nghttp3_conv.h"
3838
#include"nghttp3_unreachable.h"
39+
#include"nghttp3_str.h"
3940
#include"sfparse/sfparse.h"
4041

41-
staticuint8_tdowncase(uint8_tc) {
42-
return'A' <= c&&c <= 'Z' ? (uint8_t)(c-'A'+'a') : c;
43-
}
44-
4542
/*
4643
* memieq returns 1 if the data pointed by |a| of length |n| equals to
4744
* |b| of the same length in case-insensitive manner. The data
@@ -52,7 +49,7 @@ static int memieq(const void *a, const void *b, size_t n) {
5249
constuint8_t*aa=a, *bb=b;
5350

5451
for (i=0; i<n; ++i) {
55-
if (aa[i] !=downcase(bb[i])) {
52+
if (aa[i] !=nghttp3_downcase_byte(bb[i])) {
5653
return0;
5754
}
5855
}
@@ -704,7 +701,7 @@ int nghttp3_check_header_name(const uint8_t *name, size_t len) {
704701
--len;
705702
}
706703
for (last=name+len; name!=last; ++name) {
707-
if (!VALID_HD_NAME_CHARS[*name]) {
704+
if (VALID_HD_NAME_CHARS[*name]!=1) {
708705
return0;
709706
}
710707
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uint8_t *nghttp3_qpack_huffman_encode(uint8_t *dest, const uint8_t *src,
8080
voidnghttp3_qpack_huffman_decode_context_init(
8181
nghttp3_qpack_huffman_decode_context*ctx) {
8282
*ctx= (nghttp3_qpack_huffman_decode_context){
83-
.flags=NGHTTP3_QPACK_HUFFMAN_ACCEPTED,
83+
.flags=NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED,
8484
};
8585
}
8686

@@ -103,20 +103,20 @@ nghttp3_qpack_huffman_decode(nghttp3_qpack_huffman_decode_context *ctx,
103103
for (; src!=end;) {
104104
c=*src++;
105105
t=qpack_huffman_decode_table[t.fstate][c >> 4];
106-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
106+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
107107
*p++=t.sym;
108108
}
109109

110110
t=qpack_huffman_decode_table[t.fstate][c&0xFU];
111-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
111+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
112112
*p++=t.sym;
113113
}
114114
}
115115

116116
ctx->fstate=t.fstate;
117117
ctx->flags=t.flags;
118118

119-
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_ACCEPTED)) {
119+
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED)) {
120120
returnNGHTTP3_ERR_QPACK_FATAL;
121121
}
122122

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_qpack_huffman.hβ€Ž

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@ size_t nghttp3_qpack_huffman_encode_count(const uint8_t *src, size_t len);
4646
uint8_t*nghttp3_qpack_huffman_encode(uint8_t*dest, constuint8_t*src,
4747
size_tsrclen);
4848

49-
typedefenumnghttp3_qpack_huffman_decode_flag {
50-
/* FSA accepts this state as the end of huffman encoding
51-
sequence. */
52-
NGHTTP3_QPACK_HUFFMAN_ACCEPTED=1,
53-
/* This state emits symbol */
54-
NGHTTP3_QPACK_HUFFMAN_SYM=1 << 1,
55-
} nghttp3_qpack_huffman_decode_flag;
49+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED indicates that FSA accepts this
50+
state as the end of huffman encoding sequence. */
51+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED 0x01U
52+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_SYM indicates that this state emits
53+
symbol */
54+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_SYM 0x02U
5655

5756
typedefstructnghttp3_qpack_huffman_decode_node {
5857
/* fstate is the current huffman decoding state, which is actually
5958
the node ID of internal huffman tree with
60-
nghttp3_qpack_huffman_decode_flag OR-ed. We have 257 leaf nodes,
61-
but they are identical to root node other than emitting a symbol,
62-
so we have 256 internal nodes [1..256], inclusive. The node ID
63-
256 is a special node and it is a terminal state that means
64-
decoding failed. */
59+
NGHTTP3_QPACK_HUFFMAN_FLAG_* flags OR-ed. We have 257 leaf
60+
nodes, but they are identical to root node other than emitting a
61+
symbol, so we have 256 internal nodes [1..256], inclusive. The
62+
node ID 256 is a special node and it is a terminal state that
63+
means decoding failed. */
6564
uint16_tfstate;
6665
uint8_tflags;
67-
/* symbol if NGHTTP3_QPACK_HUFFMAN_SYM flag set */
66+
/* symbol if NGHTTP3_QPACK_HUFFMAN_FLAG_SYM flag set */
6867
uint8_tsym;
6968
} nghttp3_qpack_huffman_decode_node;
7069

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 e3304cd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.17.0
PR-URL: #64182 Backport-PR-URL: #64675 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 345d6ad commit e3304cd

13 files changed

Lines changed: 4351 additions & 4265 deletions

β€Ždeps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.hβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,25 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
26252625
NGHTTP3_EXTERNintnghttp3_conn_add_write_offset(nghttp3_conn*conn,
26262626
int64_tstream_id, size_tn);
26272627

2628+
/**
2629+
* @function
2630+
*
2631+
* `nghttp3_conn_is_stream_flushed` returns nonzero if all stream data
2632+
* for a stream identified by |stream_id| so far have been accepted by
2633+
* QUIC stack. This means that the cumulative number of bytes that
2634+
* `nghttp3_conn_add_write_offset` notified covers all stream data
2635+
* currently held. This does not mean more stream data cannot be
2636+
* submitted to this stream via :type:`nghttp3_read_data_callback` and
2637+
* all stream data have been acknowledged.
2638+
*
2639+
* If there is no stream identified by |stream_id|, this function
2640+
* returns nonzero.
2641+
*
2642+
* .. version-added:: 1.17.0
2643+
*/
2644+
NGHTTP3_EXTERNintnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2645+
int64_tstream_id);
2646+
26282647
/**
26292648
* @function
26302649
*
@@ -3418,6 +3437,75 @@ NGHTTP3_EXTERN const nghttp3_info *nghttp3_version(int least_version);
34183437
*/
34193438
NGHTTP3_EXTERNintnghttp3_err_is_fatal(intliberr);
34203439

3440+
/**
3441+
* @function
3442+
*
3443+
* `nghttp3_get_uvarint` reads variable-length unsigned integer from
3444+
* the buffer pointed by |p|, and stores it in the object pointed by
3445+
* |dest| in host byte order. It returns |p| plus the number of bytes
3446+
* read from |p|. This function assumes that |p| points to the buffer
3447+
* that contains a valid variable-length unsigned integer. Use
3448+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3449+
* decode an integer.
3450+
*
3451+
* .. version-added:: 1.17.0
3452+
*/
3453+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_uvarint(uint64_t*dest,
3454+
constuint8_t*p);
3455+
3456+
/**
3457+
* @function
3458+
*
3459+
* `nghttp3_get_uvarintlen` returns the required number of bytes to
3460+
* read variable-length unsigned integer starting at |p|. |p| must
3461+
* not be NULL. This function only reads the single byte from the
3462+
* buffer pointed by |p|, and determines the number of bytes to read.
3463+
*
3464+
* .. version-added:: 1.17.0
3465+
*/
3466+
NGHTTP3_EXTERNsize_tnghttp3_get_uvarintlen(constuint8_t*p);
3467+
3468+
/**
3469+
* @function
3470+
*
3471+
* `nghttp3_get_varint` reads variable-length unsigned integer from
3472+
* the buffer pointed by |p|, and stores it in the object pointed by
3473+
* |dest| in host byte order. It returns |p| plus the number of bytes
3474+
* read from |p|. This function assumes that |p| points to the buffer
3475+
* that contains a valid variable-length unsigned integer. Use
3476+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3477+
* decode an integer.
3478+
*
3479+
* .. version-added:: 1.17.0
3480+
*/
3481+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_varint(int64_t*dest,
3482+
constuint8_t*p);
3483+
3484+
/**
3485+
* @function
3486+
*
3487+
* `nghttp3_put_uvarint` writes |n| to the buffer pointed by |p| using
3488+
* variable-length unsigned integer encoding. It returns the one
3489+
* beyond of the last written position. This function assumes that
3490+
* the buffer pointed by |p| has sufficient capacity to encode |n|.
3491+
* To know the required capacity, use `nghttp3_put_uvarintlen`. |n|
3492+
* must be less than or equal to (1 << 62) - 1.
3493+
*
3494+
* .. version-added:: 1.17.0
3495+
*/
3496+
NGHTTP3_EXTERNuint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
3497+
3498+
/**
3499+
* @function
3500+
*
3501+
* `nghttp3_put_uvarintlen` returns the required number of bytes to
3502+
* encode |n| in variable-length unsigned integer encoding. |n| must
3503+
* be less than or equal to (1 << 62) - 1.
3504+
*
3505+
* .. version-added:: 1.17.0
3506+
*/
3507+
NGHTTP3_EXTERNsize_tnghttp3_put_uvarintlen(uint64_tn);
3508+
34213509
/*
34223510
* Versioned function wrappers
34233511
*/

β€Ž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.16.0"
34+
#defineNGHTTP3_VERSION "1.17.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_NUM0x011000
44+
#defineNGHTTP3_VERSION_NUM0x011100
4545

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,3 +2979,25 @@ int nghttp3_conn_is_drained2(const nghttp3_conn *conn) {
29792979
nghttp3_stream_outq_write_done(conn->tx.ctrl) &&
29802980
nghttp3_ringbuf_len(&conn->tx.ctrl->frq) ==0;
29812981
}
2982+
2983+
intnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2984+
int64_tstream_id) {
2985+
nghttp3_stream*stream=nghttp3_conn_find_stream(conn, stream_id);
2986+
constnghttp3_frame*fr;
2987+
2988+
if (!stream) {
2989+
return1;
2990+
}
2991+
2992+
if (!nghttp3_stream_outq_write_done(stream)) {
2993+
return0;
2994+
}
2995+
2996+
if (nghttp3_ringbuf_len(&stream->frq) ==0) {
2997+
return1;
2998+
}
2999+
3000+
fr=nghttp3_ringbuf_get(&stream->frq, 0);
3001+
3002+
returnfr->hd.type==NGHTTP3_FRAME_DATA;
3003+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ size_t nghttp3_get_uvarintlen(const uint8_t *p) {
7070
return (size_t)(1U << (*p >> 6));
7171
}
7272

73+
constuint8_t*nghttp3_get_varint(int64_t*dest, constuint8_t*p) {
74+
uint64_tn;
75+
76+
p=nghttp3_get_uvarint(&n, p);
77+
*dest= (int64_t)n;
78+
79+
returnp;
80+
}
81+
7382
uint8_t*nghttp3_put_uint64be(uint8_t*p, uint64_tn) {
7483
n=nghttp3_htonl64(n);
7584
returnnghttp3_cpymem(p, (constuint8_t*)&n, sizeof(n));

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_conv.hβ€Ž

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@
9292
# definentohs(N) _byteswap_ushort(N)
9393
#endif/* defined(WIN32) */
9494

95-
/*
96-
* nghttp3_get_uvarint reads variable-length unsigned integer from
97-
* |p|, and stores it in the buffer pointed by |dest| in host byte
98-
* order. It returns |p| plus the number of bytes read from |p|.
99-
*/
100-
constuint8_t*nghttp3_get_uvarint(uint64_t*dest, constuint8_t*p);
101-
102-
/*
103-
* nghttp3_get_uvarintlen returns the required number of bytes to read
104-
* variable-length integer starting at |p|.
105-
*/
106-
size_tnghttp3_get_uvarintlen(constuint8_t*p);
107-
108-
/*
109-
* nghttp3_get_varint reads variable-length unsigned integer from |p|,
110-
* and stores it in the buffer pointed by |dest| in host byte order.
111-
* It returns |p| plus the number of bytes read from |p|.
112-
*/
113-
staticinlineconstuint8_t*nghttp3_get_varint(int64_t*dest,
114-
constuint8_t*p) {
115-
uint64_tn;
116-
117-
p=nghttp3_get_uvarint(&n, p);
118-
*dest= (int64_t)n;
119-
120-
returnp;
121-
}
122-
12395
/*
12496
* nghttp3_put_uint64be writes |n| in host byte order in |p| in
12597
* network byte order. It returns the one beyond of the last written
@@ -141,18 +113,6 @@ uint8_t *nghttp3_put_uint32be(uint8_t *p, uint32_t n);
141113
*/
142114
uint8_t*nghttp3_put_uint16be(uint8_t*p, uint16_tn);
143115

144-
/*
145-
* nghttp3_put_uvarint writes |n| in |p| using variable-length integer
146-
* encoding. It returns the one beyond of the last written position.
147-
*/
148-
uint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
149-
150-
/*
151-
* nghttp3_put_uvarintlen returns the required number of bytes to
152-
* encode |n|.
153-
*/
154-
size_tnghttp3_put_uvarintlen(uint64_tn);
155-
156116
/*
157117
* nghttp3_ord_stream_id returns the ordinal number of |stream_id|.
158118
*/

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include"nghttp3_macro.h"
3737
#include"nghttp3_conv.h"
3838
#include"nghttp3_unreachable.h"
39+
#include"nghttp3_str.h"
3940
#include"sfparse/sfparse.h"
4041

41-
staticuint8_tdowncase(uint8_tc) {
42-
return'A' <= c&&c <= 'Z' ? (uint8_t)(c-'A'+'a') : c;
43-
}
44-
4542
/*
4643
* memieq returns 1 if the data pointed by |a| of length |n| equals to
4744
* |b| of the same length in case-insensitive manner. The data
@@ -52,7 +49,7 @@ static int memieq(const void *a, const void *b, size_t n) {
5249
constuint8_t*aa=a, *bb=b;
5350

5451
for (i=0; i<n; ++i) {
55-
if (aa[i] !=downcase(bb[i])) {
52+
if (aa[i] !=nghttp3_downcase_byte(bb[i])) {
5653
return0;
5754
}
5855
}
@@ -704,7 +701,7 @@ int nghttp3_check_header_name(const uint8_t *name, size_t len) {
704701
--len;
705702
}
706703
for (last=name+len; name!=last; ++name) {
707-
if (!VALID_HD_NAME_CHARS[*name]) {
704+
if (VALID_HD_NAME_CHARS[*name]!=1) {
708705
return0;
709706
}
710707
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uint8_t *nghttp3_qpack_huffman_encode(uint8_t *dest, const uint8_t *src,
8080
voidnghttp3_qpack_huffman_decode_context_init(
8181
nghttp3_qpack_huffman_decode_context*ctx) {
8282
*ctx= (nghttp3_qpack_huffman_decode_context){
83-
.flags=NGHTTP3_QPACK_HUFFMAN_ACCEPTED,
83+
.flags=NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED,
8484
};
8585
}
8686

@@ -103,20 +103,20 @@ nghttp3_qpack_huffman_decode(nghttp3_qpack_huffman_decode_context *ctx,
103103
for (; src!=end;) {
104104
c=*src++;
105105
t=qpack_huffman_decode_table[t.fstate][c >> 4];
106-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
106+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
107107
*p++=t.sym;
108108
}
109109

110110
t=qpack_huffman_decode_table[t.fstate][c&0xFU];
111-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
111+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
112112
*p++=t.sym;
113113
}
114114
}
115115

116116
ctx->fstate=t.fstate;
117117
ctx->flags=t.flags;
118118

119-
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_ACCEPTED)) {
119+
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED)) {
120120
returnNGHTTP3_ERR_QPACK_FATAL;
121121
}
122122

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_qpack_huffman.hβ€Ž

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@ size_t nghttp3_qpack_huffman_encode_count(const uint8_t *src, size_t len);
4646
uint8_t*nghttp3_qpack_huffman_encode(uint8_t*dest, constuint8_t*src,
4747
size_tsrclen);
4848

49-
typedefenumnghttp3_qpack_huffman_decode_flag {
50-
/* FSA accepts this state as the end of huffman encoding
51-
sequence. */
52-
NGHTTP3_QPACK_HUFFMAN_ACCEPTED=1,
53-
/* This state emits symbol */
54-
NGHTTP3_QPACK_HUFFMAN_SYM=1 << 1,
55-
} nghttp3_qpack_huffman_decode_flag;
49+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED indicates that FSA accepts this
50+
state as the end of huffman encoding sequence. */
51+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED 0x01U
52+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_SYM indicates that this state emits
53+
symbol */
54+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_SYM 0x02U
5655

5756
typedefstructnghttp3_qpack_huffman_decode_node {
5857
/* fstate is the current huffman decoding state, which is actually
5958
the node ID of internal huffman tree with
60-
nghttp3_qpack_huffman_decode_flag OR-ed. We have 257 leaf nodes,
61-
but they are identical to root node other than emitting a symbol,
62-
so we have 256 internal nodes [1..256], inclusive. The node ID
63-
256 is a special node and it is a terminal state that means
64-
decoding failed. */
59+
NGHTTP3_QPACK_HUFFMAN_FLAG_* flags OR-ed. We have 257 leaf
60+
nodes, but they are identical to root node other than emitting a
61+
symbol, so we have 256 internal nodes [1..256], inclusive. The
62+
node ID 256 is a special node and it is a terminal state that
63+
means decoding failed. */
6564
uint16_tfstate;
6665
uint8_tflags;
67-
/* symbol if NGHTTP3_QPACK_HUFFMAN_SYM flag set */
66+
/* symbol if NGHTTP3_QPACK_HUFFMAN_FLAG_SYM flag set */
6867
uint8_tsym;
6968
} nghttp3_qpack_huffman_decode_node;
7069

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 e3304cd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.17.0
PR-URL: #64182 Backport-PR-URL: #64675 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 345d6ad commit e3304cd

13 files changed

Lines changed: 4351 additions & 4265 deletions

β€Ždeps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.hβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,25 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
26252625
NGHTTP3_EXTERNintnghttp3_conn_add_write_offset(nghttp3_conn*conn,
26262626
int64_tstream_id, size_tn);
26272627

2628+
/**
2629+
* @function
2630+
*
2631+
* `nghttp3_conn_is_stream_flushed` returns nonzero if all stream data
2632+
* for a stream identified by |stream_id| so far have been accepted by
2633+
* QUIC stack. This means that the cumulative number of bytes that
2634+
* `nghttp3_conn_add_write_offset` notified covers all stream data
2635+
* currently held. This does not mean more stream data cannot be
2636+
* submitted to this stream via :type:`nghttp3_read_data_callback` and
2637+
* all stream data have been acknowledged.
2638+
*
2639+
* If there is no stream identified by |stream_id|, this function
2640+
* returns nonzero.
2641+
*
2642+
* .. version-added:: 1.17.0
2643+
*/
2644+
NGHTTP3_EXTERNintnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2645+
int64_tstream_id);
2646+
26282647
/**
26292648
* @function
26302649
*
@@ -3418,6 +3437,75 @@ NGHTTP3_EXTERN const nghttp3_info *nghttp3_version(int least_version);
34183437
*/
34193438
NGHTTP3_EXTERNintnghttp3_err_is_fatal(intliberr);
34203439

3440+
/**
3441+
* @function
3442+
*
3443+
* `nghttp3_get_uvarint` reads variable-length unsigned integer from
3444+
* the buffer pointed by |p|, and stores it in the object pointed by
3445+
* |dest| in host byte order. It returns |p| plus the number of bytes
3446+
* read from |p|. This function assumes that |p| points to the buffer
3447+
* that contains a valid variable-length unsigned integer. Use
3448+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3449+
* decode an integer.
3450+
*
3451+
* .. version-added:: 1.17.0
3452+
*/
3453+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_uvarint(uint64_t*dest,
3454+
constuint8_t*p);
3455+
3456+
/**
3457+
* @function
3458+
*
3459+
* `nghttp3_get_uvarintlen` returns the required number of bytes to
3460+
* read variable-length unsigned integer starting at |p|. |p| must
3461+
* not be NULL. This function only reads the single byte from the
3462+
* buffer pointed by |p|, and determines the number of bytes to read.
3463+
*
3464+
* .. version-added:: 1.17.0
3465+
*/
3466+
NGHTTP3_EXTERNsize_tnghttp3_get_uvarintlen(constuint8_t*p);
3467+
3468+
/**
3469+
* @function
3470+
*
3471+
* `nghttp3_get_varint` reads variable-length unsigned integer from
3472+
* the buffer pointed by |p|, and stores it in the object pointed by
3473+
* |dest| in host byte order. It returns |p| plus the number of bytes
3474+
* read from |p|. This function assumes that |p| points to the buffer
3475+
* that contains a valid variable-length unsigned integer. Use
3476+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3477+
* decode an integer.
3478+
*
3479+
* .. version-added:: 1.17.0
3480+
*/
3481+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_varint(int64_t*dest,
3482+
constuint8_t*p);
3483+
3484+
/**
3485+
* @function
3486+
*
3487+
* `nghttp3_put_uvarint` writes |n| to the buffer pointed by |p| using
3488+
* variable-length unsigned integer encoding. It returns the one
3489+
* beyond of the last written position. This function assumes that
3490+
* the buffer pointed by |p| has sufficient capacity to encode |n|.
3491+
* To know the required capacity, use `nghttp3_put_uvarintlen`. |n|
3492+
* must be less than or equal to (1 << 62) - 1.
3493+
*
3494+
* .. version-added:: 1.17.0
3495+
*/
3496+
NGHTTP3_EXTERNuint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
3497+
3498+
/**
3499+
* @function
3500+
*
3501+
* `nghttp3_put_uvarintlen` returns the required number of bytes to
3502+
* encode |n| in variable-length unsigned integer encoding. |n| must
3503+
* be less than or equal to (1 << 62) - 1.
3504+
*
3505+
* .. version-added:: 1.17.0
3506+
*/
3507+
NGHTTP3_EXTERNsize_tnghttp3_put_uvarintlen(uint64_tn);
3508+
34213509
/*
34223510
* Versioned function wrappers
34233511
*/

β€Ž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.16.0"
34+
#defineNGHTTP3_VERSION "1.17.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_NUM0x011000
44+
#defineNGHTTP3_VERSION_NUM0x011100
4545

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,3 +2979,25 @@ int nghttp3_conn_is_drained2(const nghttp3_conn *conn) {
29792979
nghttp3_stream_outq_write_done(conn->tx.ctrl) &&
29802980
nghttp3_ringbuf_len(&conn->tx.ctrl->frq) ==0;
29812981
}
2982+
2983+
intnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2984+
int64_tstream_id) {
2985+
nghttp3_stream*stream=nghttp3_conn_find_stream(conn, stream_id);
2986+
constnghttp3_frame*fr;
2987+
2988+
if (!stream) {
2989+
return1;
2990+
}
2991+
2992+
if (!nghttp3_stream_outq_write_done(stream)) {
2993+
return0;
2994+
}
2995+
2996+
if (nghttp3_ringbuf_len(&stream->frq) ==0) {
2997+
return1;
2998+
}
2999+
3000+
fr=nghttp3_ringbuf_get(&stream->frq, 0);
3001+
3002+
returnfr->hd.type==NGHTTP3_FRAME_DATA;
3003+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ size_t nghttp3_get_uvarintlen(const uint8_t *p) {
7070
return (size_t)(1U << (*p >> 6));
7171
}
7272

73+
constuint8_t*nghttp3_get_varint(int64_t*dest, constuint8_t*p) {
74+
uint64_tn;
75+
76+
p=nghttp3_get_uvarint(&n, p);
77+
*dest= (int64_t)n;
78+
79+
returnp;
80+
}
81+
7382
uint8_t*nghttp3_put_uint64be(uint8_t*p, uint64_tn) {
7483
n=nghttp3_htonl64(n);
7584
returnnghttp3_cpymem(p, (constuint8_t*)&n, sizeof(n));

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_conv.hβ€Ž

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@
9292
# definentohs(N) _byteswap_ushort(N)
9393
#endif/* defined(WIN32) */
9494

95-
/*
96-
* nghttp3_get_uvarint reads variable-length unsigned integer from
97-
* |p|, and stores it in the buffer pointed by |dest| in host byte
98-
* order. It returns |p| plus the number of bytes read from |p|.
99-
*/
100-
constuint8_t*nghttp3_get_uvarint(uint64_t*dest, constuint8_t*p);
101-
102-
/*
103-
* nghttp3_get_uvarintlen returns the required number of bytes to read
104-
* variable-length integer starting at |p|.
105-
*/
106-
size_tnghttp3_get_uvarintlen(constuint8_t*p);
107-
108-
/*
109-
* nghttp3_get_varint reads variable-length unsigned integer from |p|,
110-
* and stores it in the buffer pointed by |dest| in host byte order.
111-
* It returns |p| plus the number of bytes read from |p|.
112-
*/
113-
staticinlineconstuint8_t*nghttp3_get_varint(int64_t*dest,
114-
constuint8_t*p) {
115-
uint64_tn;
116-
117-
p=nghttp3_get_uvarint(&n, p);
118-
*dest= (int64_t)n;
119-
120-
returnp;
121-
}
122-
12395
/*
12496
* nghttp3_put_uint64be writes |n| in host byte order in |p| in
12597
* network byte order. It returns the one beyond of the last written
@@ -141,18 +113,6 @@ uint8_t *nghttp3_put_uint32be(uint8_t *p, uint32_t n);
141113
*/
142114
uint8_t*nghttp3_put_uint16be(uint8_t*p, uint16_tn);
143115

144-
/*
145-
* nghttp3_put_uvarint writes |n| in |p| using variable-length integer
146-
* encoding. It returns the one beyond of the last written position.
147-
*/
148-
uint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
149-
150-
/*
151-
* nghttp3_put_uvarintlen returns the required number of bytes to
152-
* encode |n|.
153-
*/
154-
size_tnghttp3_put_uvarintlen(uint64_tn);
155-
156116
/*
157117
* nghttp3_ord_stream_id returns the ordinal number of |stream_id|.
158118
*/

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include"nghttp3_macro.h"
3737
#include"nghttp3_conv.h"
3838
#include"nghttp3_unreachable.h"
39+
#include"nghttp3_str.h"
3940
#include"sfparse/sfparse.h"
4041

41-
staticuint8_tdowncase(uint8_tc) {
42-
return'A' <= c&&c <= 'Z' ? (uint8_t)(c-'A'+'a') : c;
43-
}
44-
4542
/*
4643
* memieq returns 1 if the data pointed by |a| of length |n| equals to
4744
* |b| of the same length in case-insensitive manner. The data
@@ -52,7 +49,7 @@ static int memieq(const void *a, const void *b, size_t n) {
5249
constuint8_t*aa=a, *bb=b;
5350

5451
for (i=0; i<n; ++i) {
55-
if (aa[i] !=downcase(bb[i])) {
52+
if (aa[i] !=nghttp3_downcase_byte(bb[i])) {
5653
return0;
5754
}
5855
}
@@ -704,7 +701,7 @@ int nghttp3_check_header_name(const uint8_t *name, size_t len) {
704701
--len;
705702
}
706703
for (last=name+len; name!=last; ++name) {
707-
if (!VALID_HD_NAME_CHARS[*name]) {
704+
if (VALID_HD_NAME_CHARS[*name]!=1) {
708705
return0;
709706
}
710707
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uint8_t *nghttp3_qpack_huffman_encode(uint8_t *dest, const uint8_t *src,
8080
voidnghttp3_qpack_huffman_decode_context_init(
8181
nghttp3_qpack_huffman_decode_context*ctx) {
8282
*ctx= (nghttp3_qpack_huffman_decode_context){
83-
.flags=NGHTTP3_QPACK_HUFFMAN_ACCEPTED,
83+
.flags=NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED,
8484
};
8585
}
8686

@@ -103,20 +103,20 @@ nghttp3_qpack_huffman_decode(nghttp3_qpack_huffman_decode_context *ctx,
103103
for (; src!=end;) {
104104
c=*src++;
105105
t=qpack_huffman_decode_table[t.fstate][c >> 4];
106-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
106+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
107107
*p++=t.sym;
108108
}
109109

110110
t=qpack_huffman_decode_table[t.fstate][c&0xFU];
111-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
111+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
112112
*p++=t.sym;
113113
}
114114
}
115115

116116
ctx->fstate=t.fstate;
117117
ctx->flags=t.flags;
118118

119-
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_ACCEPTED)) {
119+
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED)) {
120120
returnNGHTTP3_ERR_QPACK_FATAL;
121121
}
122122

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_qpack_huffman.hβ€Ž

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@ size_t nghttp3_qpack_huffman_encode_count(const uint8_t *src, size_t len);
4646
uint8_t*nghttp3_qpack_huffman_encode(uint8_t*dest, constuint8_t*src,
4747
size_tsrclen);
4848

49-
typedefenumnghttp3_qpack_huffman_decode_flag {
50-
/* FSA accepts this state as the end of huffman encoding
51-
sequence. */
52-
NGHTTP3_QPACK_HUFFMAN_ACCEPTED=1,
53-
/* This state emits symbol */
54-
NGHTTP3_QPACK_HUFFMAN_SYM=1 << 1,
55-
} nghttp3_qpack_huffman_decode_flag;
49+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED indicates that FSA accepts this
50+
state as the end of huffman encoding sequence. */
51+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED 0x01U
52+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_SYM indicates that this state emits
53+
symbol */
54+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_SYM 0x02U
5655

5756
typedefstructnghttp3_qpack_huffman_decode_node {
5857
/* fstate is the current huffman decoding state, which is actually
5958
the node ID of internal huffman tree with
60-
nghttp3_qpack_huffman_decode_flag OR-ed. We have 257 leaf nodes,
61-
but they are identical to root node other than emitting a symbol,
62-
so we have 256 internal nodes [1..256], inclusive. The node ID
63-
256 is a special node and it is a terminal state that means
64-
decoding failed. */
59+
NGHTTP3_QPACK_HUFFMAN_FLAG_* flags OR-ed. We have 257 leaf
60+
nodes, but they are identical to root node other than emitting a
61+
symbol, so we have 256 internal nodes [1..256], inclusive. The
62+
node ID 256 is a special node and it is a terminal state that
63+
means decoding failed. */
6564
uint16_tfstate;
6665
uint8_tflags;
67-
/* symbol if NGHTTP3_QPACK_HUFFMAN_SYM flag set */
66+
/* symbol if NGHTTP3_QPACK_HUFFMAN_FLAG_SYM flag set */
6867
uint8_tsym;
6968
} nghttp3_qpack_huffman_decode_node;
7069

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 e3304cd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.17.0
PR-URL: #64182 Backport-PR-URL: #64675 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 345d6ad commit e3304cd

13 files changed

Lines changed: 4351 additions & 4265 deletions

β€Ždeps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.hβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,25 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
26252625
NGHTTP3_EXTERNintnghttp3_conn_add_write_offset(nghttp3_conn*conn,
26262626
int64_tstream_id, size_tn);
26272627

2628+
/**
2629+
* @function
2630+
*
2631+
* `nghttp3_conn_is_stream_flushed` returns nonzero if all stream data
2632+
* for a stream identified by |stream_id| so far have been accepted by
2633+
* QUIC stack. This means that the cumulative number of bytes that
2634+
* `nghttp3_conn_add_write_offset` notified covers all stream data
2635+
* currently held. This does not mean more stream data cannot be
2636+
* submitted to this stream via :type:`nghttp3_read_data_callback` and
2637+
* all stream data have been acknowledged.
2638+
*
2639+
* If there is no stream identified by |stream_id|, this function
2640+
* returns nonzero.
2641+
*
2642+
* .. version-added:: 1.17.0
2643+
*/
2644+
NGHTTP3_EXTERNintnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2645+
int64_tstream_id);
2646+
26282647
/**
26292648
* @function
26302649
*
@@ -3418,6 +3437,75 @@ NGHTTP3_EXTERN const nghttp3_info *nghttp3_version(int least_version);
34183437
*/
34193438
NGHTTP3_EXTERNintnghttp3_err_is_fatal(intliberr);
34203439

3440+
/**
3441+
* @function
3442+
*
3443+
* `nghttp3_get_uvarint` reads variable-length unsigned integer from
3444+
* the buffer pointed by |p|, and stores it in the object pointed by
3445+
* |dest| in host byte order. It returns |p| plus the number of bytes
3446+
* read from |p|. This function assumes that |p| points to the buffer
3447+
* that contains a valid variable-length unsigned integer. Use
3448+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3449+
* decode an integer.
3450+
*
3451+
* .. version-added:: 1.17.0
3452+
*/
3453+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_uvarint(uint64_t*dest,
3454+
constuint8_t*p);
3455+
3456+
/**
3457+
* @function
3458+
*
3459+
* `nghttp3_get_uvarintlen` returns the required number of bytes to
3460+
* read variable-length unsigned integer starting at |p|. |p| must
3461+
* not be NULL. This function only reads the single byte from the
3462+
* buffer pointed by |p|, and determines the number of bytes to read.
3463+
*
3464+
* .. version-added:: 1.17.0
3465+
*/
3466+
NGHTTP3_EXTERNsize_tnghttp3_get_uvarintlen(constuint8_t*p);
3467+
3468+
/**
3469+
* @function
3470+
*
3471+
* `nghttp3_get_varint` reads variable-length unsigned integer from
3472+
* the buffer pointed by |p|, and stores it in the object pointed by
3473+
* |dest| in host byte order. It returns |p| plus the number of bytes
3474+
* read from |p|. This function assumes that |p| points to the buffer
3475+
* that contains a valid variable-length unsigned integer. Use
3476+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3477+
* decode an integer.
3478+
*
3479+
* .. version-added:: 1.17.0
3480+
*/
3481+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_varint(int64_t*dest,
3482+
constuint8_t*p);
3483+
3484+
/**
3485+
* @function
3486+
*
3487+
* `nghttp3_put_uvarint` writes |n| to the buffer pointed by |p| using
3488+
* variable-length unsigned integer encoding. It returns the one
3489+
* beyond of the last written position. This function assumes that
3490+
* the buffer pointed by |p| has sufficient capacity to encode |n|.
3491+
* To know the required capacity, use `nghttp3_put_uvarintlen`. |n|
3492+
* must be less than or equal to (1 << 62) - 1.
3493+
*
3494+
* .. version-added:: 1.17.0
3495+
*/
3496+
NGHTTP3_EXTERNuint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
3497+
3498+
/**
3499+
* @function
3500+
*
3501+
* `nghttp3_put_uvarintlen` returns the required number of bytes to
3502+
* encode |n| in variable-length unsigned integer encoding. |n| must
3503+
* be less than or equal to (1 << 62) - 1.
3504+
*
3505+
* .. version-added:: 1.17.0
3506+
*/
3507+
NGHTTP3_EXTERNsize_tnghttp3_put_uvarintlen(uint64_tn);
3508+
34213509
/*
34223510
* Versioned function wrappers
34233511
*/

β€Ž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.16.0"
34+
#defineNGHTTP3_VERSION "1.17.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_NUM0x011000
44+
#defineNGHTTP3_VERSION_NUM0x011100
4545

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,3 +2979,25 @@ int nghttp3_conn_is_drained2(const nghttp3_conn *conn) {
29792979
nghttp3_stream_outq_write_done(conn->tx.ctrl) &&
29802980
nghttp3_ringbuf_len(&conn->tx.ctrl->frq) ==0;
29812981
}
2982+
2983+
intnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2984+
int64_tstream_id) {
2985+
nghttp3_stream*stream=nghttp3_conn_find_stream(conn, stream_id);
2986+
constnghttp3_frame*fr;
2987+
2988+
if (!stream) {
2989+
return1;
2990+
}
2991+
2992+
if (!nghttp3_stream_outq_write_done(stream)) {
2993+
return0;
2994+
}
2995+
2996+
if (nghttp3_ringbuf_len(&stream->frq) ==0) {
2997+
return1;
2998+
}
2999+
3000+
fr=nghttp3_ringbuf_get(&stream->frq, 0);
3001+
3002+
returnfr->hd.type==NGHTTP3_FRAME_DATA;
3003+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ size_t nghttp3_get_uvarintlen(const uint8_t *p) {
7070
return (size_t)(1U << (*p >> 6));
7171
}
7272

73+
constuint8_t*nghttp3_get_varint(int64_t*dest, constuint8_t*p) {
74+
uint64_tn;
75+
76+
p=nghttp3_get_uvarint(&n, p);
77+
*dest= (int64_t)n;
78+
79+
returnp;
80+
}
81+
7382
uint8_t*nghttp3_put_uint64be(uint8_t*p, uint64_tn) {
7483
n=nghttp3_htonl64(n);
7584
returnnghttp3_cpymem(p, (constuint8_t*)&n, sizeof(n));

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_conv.hβ€Ž

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@
9292
# definentohs(N) _byteswap_ushort(N)
9393
#endif/* defined(WIN32) */
9494

95-
/*
96-
* nghttp3_get_uvarint reads variable-length unsigned integer from
97-
* |p|, and stores it in the buffer pointed by |dest| in host byte
98-
* order. It returns |p| plus the number of bytes read from |p|.
99-
*/
100-
constuint8_t*nghttp3_get_uvarint(uint64_t*dest, constuint8_t*p);
101-
102-
/*
103-
* nghttp3_get_uvarintlen returns the required number of bytes to read
104-
* variable-length integer starting at |p|.
105-
*/
106-
size_tnghttp3_get_uvarintlen(constuint8_t*p);
107-
108-
/*
109-
* nghttp3_get_varint reads variable-length unsigned integer from |p|,
110-
* and stores it in the buffer pointed by |dest| in host byte order.
111-
* It returns |p| plus the number of bytes read from |p|.
112-
*/
113-
staticinlineconstuint8_t*nghttp3_get_varint(int64_t*dest,
114-
constuint8_t*p) {
115-
uint64_tn;
116-
117-
p=nghttp3_get_uvarint(&n, p);
118-
*dest= (int64_t)n;
119-
120-
returnp;
121-
}
122-
12395
/*
12496
* nghttp3_put_uint64be writes |n| in host byte order in |p| in
12597
* network byte order. It returns the one beyond of the last written
@@ -141,18 +113,6 @@ uint8_t *nghttp3_put_uint32be(uint8_t *p, uint32_t n);
141113
*/
142114
uint8_t*nghttp3_put_uint16be(uint8_t*p, uint16_tn);
143115

144-
/*
145-
* nghttp3_put_uvarint writes |n| in |p| using variable-length integer
146-
* encoding. It returns the one beyond of the last written position.
147-
*/
148-
uint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
149-
150-
/*
151-
* nghttp3_put_uvarintlen returns the required number of bytes to
152-
* encode |n|.
153-
*/
154-
size_tnghttp3_put_uvarintlen(uint64_tn);
155-
156116
/*
157117
* nghttp3_ord_stream_id returns the ordinal number of |stream_id|.
158118
*/

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include"nghttp3_macro.h"
3737
#include"nghttp3_conv.h"
3838
#include"nghttp3_unreachable.h"
39+
#include"nghttp3_str.h"
3940
#include"sfparse/sfparse.h"
4041

41-
staticuint8_tdowncase(uint8_tc) {
42-
return'A' <= c&&c <= 'Z' ? (uint8_t)(c-'A'+'a') : c;
43-
}
44-
4542
/*
4643
* memieq returns 1 if the data pointed by |a| of length |n| equals to
4744
* |b| of the same length in case-insensitive manner. The data
@@ -52,7 +49,7 @@ static int memieq(const void *a, const void *b, size_t n) {
5249
constuint8_t*aa=a, *bb=b;
5350

5451
for (i=0; i<n; ++i) {
55-
if (aa[i] !=downcase(bb[i])) {
52+
if (aa[i] !=nghttp3_downcase_byte(bb[i])) {
5653
return0;
5754
}
5855
}
@@ -704,7 +701,7 @@ int nghttp3_check_header_name(const uint8_t *name, size_t len) {
704701
--len;
705702
}
706703
for (last=name+len; name!=last; ++name) {
707-
if (!VALID_HD_NAME_CHARS[*name]) {
704+
if (VALID_HD_NAME_CHARS[*name]!=1) {
708705
return0;
709706
}
710707
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uint8_t *nghttp3_qpack_huffman_encode(uint8_t *dest, const uint8_t *src,
8080
voidnghttp3_qpack_huffman_decode_context_init(
8181
nghttp3_qpack_huffman_decode_context*ctx) {
8282
*ctx= (nghttp3_qpack_huffman_decode_context){
83-
.flags=NGHTTP3_QPACK_HUFFMAN_ACCEPTED,
83+
.flags=NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED,
8484
};
8585
}
8686

@@ -103,20 +103,20 @@ nghttp3_qpack_huffman_decode(nghttp3_qpack_huffman_decode_context *ctx,
103103
for (; src!=end;) {
104104
c=*src++;
105105
t=qpack_huffman_decode_table[t.fstate][c >> 4];
106-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
106+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
107107
*p++=t.sym;
108108
}
109109

110110
t=qpack_huffman_decode_table[t.fstate][c&0xFU];
111-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
111+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
112112
*p++=t.sym;
113113
}
114114
}
115115

116116
ctx->fstate=t.fstate;
117117
ctx->flags=t.flags;
118118

119-
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_ACCEPTED)) {
119+
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED)) {
120120
returnNGHTTP3_ERR_QPACK_FATAL;
121121
}
122122

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_qpack_huffman.hβ€Ž

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@ size_t nghttp3_qpack_huffman_encode_count(const uint8_t *src, size_t len);
4646
uint8_t*nghttp3_qpack_huffman_encode(uint8_t*dest, constuint8_t*src,
4747
size_tsrclen);
4848

49-
typedefenumnghttp3_qpack_huffman_decode_flag {
50-
/* FSA accepts this state as the end of huffman encoding
51-
sequence. */
52-
NGHTTP3_QPACK_HUFFMAN_ACCEPTED=1,
53-
/* This state emits symbol */
54-
NGHTTP3_QPACK_HUFFMAN_SYM=1 << 1,
55-
} nghttp3_qpack_huffman_decode_flag;
49+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED indicates that FSA accepts this
50+
state as the end of huffman encoding sequence. */
51+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED 0x01U
52+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_SYM indicates that this state emits
53+
symbol */
54+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_SYM 0x02U
5655

5756
typedefstructnghttp3_qpack_huffman_decode_node {
5857
/* fstate is the current huffman decoding state, which is actually
5958
the node ID of internal huffman tree with
60-
nghttp3_qpack_huffman_decode_flag OR-ed. We have 257 leaf nodes,
61-
but they are identical to root node other than emitting a symbol,
62-
so we have 256 internal nodes [1..256], inclusive. The node ID
63-
256 is a special node and it is a terminal state that means
64-
decoding failed. */
59+
NGHTTP3_QPACK_HUFFMAN_FLAG_* flags OR-ed. We have 257 leaf
60+
nodes, but they are identical to root node other than emitting a
61+
symbol, so we have 256 internal nodes [1..256], inclusive. The
62+
node ID 256 is a special node and it is a terminal state that
63+
means decoding failed. */
6564
uint16_tfstate;
6665
uint8_tflags;
67-
/* symbol if NGHTTP3_QPACK_HUFFMAN_SYM flag set */
66+
/* symbol if NGHTTP3_QPACK_HUFFMAN_FLAG_SYM flag set */
6867
uint8_tsym;
6968
} nghttp3_qpack_huffman_decode_node;
7069

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 e3304cd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.17.0
PR-URL: #64182 Backport-PR-URL: #64675 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 345d6ad commit e3304cd

13 files changed

Lines changed: 4351 additions & 4265 deletions

β€Ždeps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.hβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,25 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
26252625
NGHTTP3_EXTERNintnghttp3_conn_add_write_offset(nghttp3_conn*conn,
26262626
int64_tstream_id, size_tn);
26272627

2628+
/**
2629+
* @function
2630+
*
2631+
* `nghttp3_conn_is_stream_flushed` returns nonzero if all stream data
2632+
* for a stream identified by |stream_id| so far have been accepted by
2633+
* QUIC stack. This means that the cumulative number of bytes that
2634+
* `nghttp3_conn_add_write_offset` notified covers all stream data
2635+
* currently held. This does not mean more stream data cannot be
2636+
* submitted to this stream via :type:`nghttp3_read_data_callback` and
2637+
* all stream data have been acknowledged.
2638+
*
2639+
* If there is no stream identified by |stream_id|, this function
2640+
* returns nonzero.
2641+
*
2642+
* .. version-added:: 1.17.0
2643+
*/
2644+
NGHTTP3_EXTERNintnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2645+
int64_tstream_id);
2646+
26282647
/**
26292648
* @function
26302649
*
@@ -3418,6 +3437,75 @@ NGHTTP3_EXTERN const nghttp3_info *nghttp3_version(int least_version);
34183437
*/
34193438
NGHTTP3_EXTERNintnghttp3_err_is_fatal(intliberr);
34203439

3440+
/**
3441+
* @function
3442+
*
3443+
* `nghttp3_get_uvarint` reads variable-length unsigned integer from
3444+
* the buffer pointed by |p|, and stores it in the object pointed by
3445+
* |dest| in host byte order. It returns |p| plus the number of bytes
3446+
* read from |p|. This function assumes that |p| points to the buffer
3447+
* that contains a valid variable-length unsigned integer. Use
3448+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3449+
* decode an integer.
3450+
*
3451+
* .. version-added:: 1.17.0
3452+
*/
3453+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_uvarint(uint64_t*dest,
3454+
constuint8_t*p);
3455+
3456+
/**
3457+
* @function
3458+
*
3459+
* `nghttp3_get_uvarintlen` returns the required number of bytes to
3460+
* read variable-length unsigned integer starting at |p|. |p| must
3461+
* not be NULL. This function only reads the single byte from the
3462+
* buffer pointed by |p|, and determines the number of bytes to read.
3463+
*
3464+
* .. version-added:: 1.17.0
3465+
*/
3466+
NGHTTP3_EXTERNsize_tnghttp3_get_uvarintlen(constuint8_t*p);
3467+
3468+
/**
3469+
* @function
3470+
*
3471+
* `nghttp3_get_varint` reads variable-length unsigned integer from
3472+
* the buffer pointed by |p|, and stores it in the object pointed by
3473+
* |dest| in host byte order. It returns |p| plus the number of bytes
3474+
* read from |p|. This function assumes that |p| points to the buffer
3475+
* that contains a valid variable-length unsigned integer. Use
3476+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3477+
* decode an integer.
3478+
*
3479+
* .. version-added:: 1.17.0
3480+
*/
3481+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_varint(int64_t*dest,
3482+
constuint8_t*p);
3483+
3484+
/**
3485+
* @function
3486+
*
3487+
* `nghttp3_put_uvarint` writes |n| to the buffer pointed by |p| using
3488+
* variable-length unsigned integer encoding. It returns the one
3489+
* beyond of the last written position. This function assumes that
3490+
* the buffer pointed by |p| has sufficient capacity to encode |n|.
3491+
* To know the required capacity, use `nghttp3_put_uvarintlen`. |n|
3492+
* must be less than or equal to (1 << 62) - 1.
3493+
*
3494+
* .. version-added:: 1.17.0
3495+
*/
3496+
NGHTTP3_EXTERNuint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
3497+
3498+
/**
3499+
* @function
3500+
*
3501+
* `nghttp3_put_uvarintlen` returns the required number of bytes to
3502+
* encode |n| in variable-length unsigned integer encoding. |n| must
3503+
* be less than or equal to (1 << 62) - 1.
3504+
*
3505+
* .. version-added:: 1.17.0
3506+
*/
3507+
NGHTTP3_EXTERNsize_tnghttp3_put_uvarintlen(uint64_tn);
3508+
34213509
/*
34223510
* Versioned function wrappers
34233511
*/

β€Ž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.16.0"
34+
#defineNGHTTP3_VERSION "1.17.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_NUM0x011000
44+
#defineNGHTTP3_VERSION_NUM0x011100
4545

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,3 +2979,25 @@ int nghttp3_conn_is_drained2(const nghttp3_conn *conn) {
29792979
nghttp3_stream_outq_write_done(conn->tx.ctrl) &&
29802980
nghttp3_ringbuf_len(&conn->tx.ctrl->frq) ==0;
29812981
}
2982+
2983+
intnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2984+
int64_tstream_id) {
2985+
nghttp3_stream*stream=nghttp3_conn_find_stream(conn, stream_id);
2986+
constnghttp3_frame*fr;
2987+
2988+
if (!stream) {
2989+
return1;
2990+
}
2991+
2992+
if (!nghttp3_stream_outq_write_done(stream)) {
2993+
return0;
2994+
}
2995+
2996+
if (nghttp3_ringbuf_len(&stream->frq) ==0) {
2997+
return1;
2998+
}
2999+
3000+
fr=nghttp3_ringbuf_get(&stream->frq, 0);
3001+
3002+
returnfr->hd.type==NGHTTP3_FRAME_DATA;
3003+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ size_t nghttp3_get_uvarintlen(const uint8_t *p) {
7070
return (size_t)(1U << (*p >> 6));
7171
}
7272

73+
constuint8_t*nghttp3_get_varint(int64_t*dest, constuint8_t*p) {
74+
uint64_tn;
75+
76+
p=nghttp3_get_uvarint(&n, p);
77+
*dest= (int64_t)n;
78+
79+
returnp;
80+
}
81+
7382
uint8_t*nghttp3_put_uint64be(uint8_t*p, uint64_tn) {
7483
n=nghttp3_htonl64(n);
7584
returnnghttp3_cpymem(p, (constuint8_t*)&n, sizeof(n));

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_conv.hβ€Ž

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@
9292
# definentohs(N) _byteswap_ushort(N)
9393
#endif/* defined(WIN32) */
9494

95-
/*
96-
* nghttp3_get_uvarint reads variable-length unsigned integer from
97-
* |p|, and stores it in the buffer pointed by |dest| in host byte
98-
* order. It returns |p| plus the number of bytes read from |p|.
99-
*/
100-
constuint8_t*nghttp3_get_uvarint(uint64_t*dest, constuint8_t*p);
101-
102-
/*
103-
* nghttp3_get_uvarintlen returns the required number of bytes to read
104-
* variable-length integer starting at |p|.
105-
*/
106-
size_tnghttp3_get_uvarintlen(constuint8_t*p);
107-
108-
/*
109-
* nghttp3_get_varint reads variable-length unsigned integer from |p|,
110-
* and stores it in the buffer pointed by |dest| in host byte order.
111-
* It returns |p| plus the number of bytes read from |p|.
112-
*/
113-
staticinlineconstuint8_t*nghttp3_get_varint(int64_t*dest,
114-
constuint8_t*p) {
115-
uint64_tn;
116-
117-
p=nghttp3_get_uvarint(&n, p);
118-
*dest= (int64_t)n;
119-
120-
returnp;
121-
}
122-
12395
/*
12496
* nghttp3_put_uint64be writes |n| in host byte order in |p| in
12597
* network byte order. It returns the one beyond of the last written
@@ -141,18 +113,6 @@ uint8_t *nghttp3_put_uint32be(uint8_t *p, uint32_t n);
141113
*/
142114
uint8_t*nghttp3_put_uint16be(uint8_t*p, uint16_tn);
143115

144-
/*
145-
* nghttp3_put_uvarint writes |n| in |p| using variable-length integer
146-
* encoding. It returns the one beyond of the last written position.
147-
*/
148-
uint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
149-
150-
/*
151-
* nghttp3_put_uvarintlen returns the required number of bytes to
152-
* encode |n|.
153-
*/
154-
size_tnghttp3_put_uvarintlen(uint64_tn);
155-
156116
/*
157117
* nghttp3_ord_stream_id returns the ordinal number of |stream_id|.
158118
*/

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include"nghttp3_macro.h"
3737
#include"nghttp3_conv.h"
3838
#include"nghttp3_unreachable.h"
39+
#include"nghttp3_str.h"
3940
#include"sfparse/sfparse.h"
4041

41-
staticuint8_tdowncase(uint8_tc) {
42-
return'A' <= c&&c <= 'Z' ? (uint8_t)(c-'A'+'a') : c;
43-
}
44-
4542
/*
4643
* memieq returns 1 if the data pointed by |a| of length |n| equals to
4744
* |b| of the same length in case-insensitive manner. The data
@@ -52,7 +49,7 @@ static int memieq(const void *a, const void *b, size_t n) {
5249
constuint8_t*aa=a, *bb=b;
5350

5451
for (i=0; i<n; ++i) {
55-
if (aa[i] !=downcase(bb[i])) {
52+
if (aa[i] !=nghttp3_downcase_byte(bb[i])) {
5653
return0;
5754
}
5855
}
@@ -704,7 +701,7 @@ int nghttp3_check_header_name(const uint8_t *name, size_t len) {
704701
--len;
705702
}
706703
for (last=name+len; name!=last; ++name) {
707-
if (!VALID_HD_NAME_CHARS[*name]) {
704+
if (VALID_HD_NAME_CHARS[*name]!=1) {
708705
return0;
709706
}
710707
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uint8_t *nghttp3_qpack_huffman_encode(uint8_t *dest, const uint8_t *src,
8080
voidnghttp3_qpack_huffman_decode_context_init(
8181
nghttp3_qpack_huffman_decode_context*ctx) {
8282
*ctx= (nghttp3_qpack_huffman_decode_context){
83-
.flags=NGHTTP3_QPACK_HUFFMAN_ACCEPTED,
83+
.flags=NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED,
8484
};
8585
}
8686

@@ -103,20 +103,20 @@ nghttp3_qpack_huffman_decode(nghttp3_qpack_huffman_decode_context *ctx,
103103
for (; src!=end;) {
104104
c=*src++;
105105
t=qpack_huffman_decode_table[t.fstate][c >> 4];
106-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
106+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
107107
*p++=t.sym;
108108
}
109109

110110
t=qpack_huffman_decode_table[t.fstate][c&0xFU];
111-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
111+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
112112
*p++=t.sym;
113113
}
114114
}
115115

116116
ctx->fstate=t.fstate;
117117
ctx->flags=t.flags;
118118

119-
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_ACCEPTED)) {
119+
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED)) {
120120
returnNGHTTP3_ERR_QPACK_FATAL;
121121
}
122122

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_qpack_huffman.hβ€Ž

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@ size_t nghttp3_qpack_huffman_encode_count(const uint8_t *src, size_t len);
4646
uint8_t*nghttp3_qpack_huffman_encode(uint8_t*dest, constuint8_t*src,
4747
size_tsrclen);
4848

49-
typedefenumnghttp3_qpack_huffman_decode_flag {
50-
/* FSA accepts this state as the end of huffman encoding
51-
sequence. */
52-
NGHTTP3_QPACK_HUFFMAN_ACCEPTED=1,
53-
/* This state emits symbol */
54-
NGHTTP3_QPACK_HUFFMAN_SYM=1 << 1,
55-
} nghttp3_qpack_huffman_decode_flag;
49+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED indicates that FSA accepts this
50+
state as the end of huffman encoding sequence. */
51+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED 0x01U
52+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_SYM indicates that this state emits
53+
symbol */
54+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_SYM 0x02U
5655

5756
typedefstructnghttp3_qpack_huffman_decode_node {
5857
/* fstate is the current huffman decoding state, which is actually
5958
the node ID of internal huffman tree with
60-
nghttp3_qpack_huffman_decode_flag OR-ed. We have 257 leaf nodes,
61-
but they are identical to root node other than emitting a symbol,
62-
so we have 256 internal nodes [1..256], inclusive. The node ID
63-
256 is a special node and it is a terminal state that means
64-
decoding failed. */
59+
NGHTTP3_QPACK_HUFFMAN_FLAG_* flags OR-ed. We have 257 leaf
60+
nodes, but they are identical to root node other than emitting a
61+
symbol, so we have 256 internal nodes [1..256], inclusive. The
62+
node ID 256 is a special node and it is a terminal state that
63+
means decoding failed. */
6564
uint16_tfstate;
6665
uint8_tflags;
67-
/* symbol if NGHTTP3_QPACK_HUFFMAN_SYM flag set */
66+
/* symbol if NGHTTP3_QPACK_HUFFMAN_FLAG_SYM flag set */
6867
uint8_tsym;
6968
} nghttp3_qpack_huffman_decode_node;
7069

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 e3304cd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.17.0
PR-URL: #64182 Backport-PR-URL: #64675 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 345d6ad commit e3304cd

13 files changed

Lines changed: 4351 additions & 4265 deletions

β€Ždeps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.hβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,25 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
26252625
NGHTTP3_EXTERNintnghttp3_conn_add_write_offset(nghttp3_conn*conn,
26262626
int64_tstream_id, size_tn);
26272627

2628+
/**
2629+
* @function
2630+
*
2631+
* `nghttp3_conn_is_stream_flushed` returns nonzero if all stream data
2632+
* for a stream identified by |stream_id| so far have been accepted by
2633+
* QUIC stack. This means that the cumulative number of bytes that
2634+
* `nghttp3_conn_add_write_offset` notified covers all stream data
2635+
* currently held. This does not mean more stream data cannot be
2636+
* submitted to this stream via :type:`nghttp3_read_data_callback` and
2637+
* all stream data have been acknowledged.
2638+
*
2639+
* If there is no stream identified by |stream_id|, this function
2640+
* returns nonzero.
2641+
*
2642+
* .. version-added:: 1.17.0
2643+
*/
2644+
NGHTTP3_EXTERNintnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2645+
int64_tstream_id);
2646+
26282647
/**
26292648
* @function
26302649
*
@@ -3418,6 +3437,75 @@ NGHTTP3_EXTERN const nghttp3_info *nghttp3_version(int least_version);
34183437
*/
34193438
NGHTTP3_EXTERNintnghttp3_err_is_fatal(intliberr);
34203439

3440+
/**
3441+
* @function
3442+
*
3443+
* `nghttp3_get_uvarint` reads variable-length unsigned integer from
3444+
* the buffer pointed by |p|, and stores it in the object pointed by
3445+
* |dest| in host byte order. It returns |p| plus the number of bytes
3446+
* read from |p|. This function assumes that |p| points to the buffer
3447+
* that contains a valid variable-length unsigned integer. Use
3448+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3449+
* decode an integer.
3450+
*
3451+
* .. version-added:: 1.17.0
3452+
*/
3453+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_uvarint(uint64_t*dest,
3454+
constuint8_t*p);
3455+
3456+
/**
3457+
* @function
3458+
*
3459+
* `nghttp3_get_uvarintlen` returns the required number of bytes to
3460+
* read variable-length unsigned integer starting at |p|. |p| must
3461+
* not be NULL. This function only reads the single byte from the
3462+
* buffer pointed by |p|, and determines the number of bytes to read.
3463+
*
3464+
* .. version-added:: 1.17.0
3465+
*/
3466+
NGHTTP3_EXTERNsize_tnghttp3_get_uvarintlen(constuint8_t*p);
3467+
3468+
/**
3469+
* @function
3470+
*
3471+
* `nghttp3_get_varint` reads variable-length unsigned integer from
3472+
* the buffer pointed by |p|, and stores it in the object pointed by
3473+
* |dest| in host byte order. It returns |p| plus the number of bytes
3474+
* read from |p|. This function assumes that |p| points to the buffer
3475+
* that contains a valid variable-length unsigned integer. Use
3476+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3477+
* decode an integer.
3478+
*
3479+
* .. version-added:: 1.17.0
3480+
*/
3481+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_varint(int64_t*dest,
3482+
constuint8_t*p);
3483+
3484+
/**
3485+
* @function
3486+
*
3487+
* `nghttp3_put_uvarint` writes |n| to the buffer pointed by |p| using
3488+
* variable-length unsigned integer encoding. It returns the one
3489+
* beyond of the last written position. This function assumes that
3490+
* the buffer pointed by |p| has sufficient capacity to encode |n|.
3491+
* To know the required capacity, use `nghttp3_put_uvarintlen`. |n|
3492+
* must be less than or equal to (1 << 62) - 1.
3493+
*
3494+
* .. version-added:: 1.17.0
3495+
*/
3496+
NGHTTP3_EXTERNuint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
3497+
3498+
/**
3499+
* @function
3500+
*
3501+
* `nghttp3_put_uvarintlen` returns the required number of bytes to
3502+
* encode |n| in variable-length unsigned integer encoding. |n| must
3503+
* be less than or equal to (1 << 62) - 1.
3504+
*
3505+
* .. version-added:: 1.17.0
3506+
*/
3507+
NGHTTP3_EXTERNsize_tnghttp3_put_uvarintlen(uint64_tn);
3508+
34213509
/*
34223510
* Versioned function wrappers
34233511
*/

β€Ž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.16.0"
34+
#defineNGHTTP3_VERSION "1.17.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_NUM0x011000
44+
#defineNGHTTP3_VERSION_NUM0x011100
4545

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,3 +2979,25 @@ int nghttp3_conn_is_drained2(const nghttp3_conn *conn) {
29792979
nghttp3_stream_outq_write_done(conn->tx.ctrl) &&
29802980
nghttp3_ringbuf_len(&conn->tx.ctrl->frq) ==0;
29812981
}
2982+
2983+
intnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2984+
int64_tstream_id) {
2985+
nghttp3_stream*stream=nghttp3_conn_find_stream(conn, stream_id);
2986+
constnghttp3_frame*fr;
2987+
2988+
if (!stream) {
2989+
return1;
2990+
}
2991+
2992+
if (!nghttp3_stream_outq_write_done(stream)) {
2993+
return0;
2994+
}
2995+
2996+
if (nghttp3_ringbuf_len(&stream->frq) ==0) {
2997+
return1;
2998+
}
2999+
3000+
fr=nghttp3_ringbuf_get(&stream->frq, 0);
3001+
3002+
returnfr->hd.type==NGHTTP3_FRAME_DATA;
3003+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ size_t nghttp3_get_uvarintlen(const uint8_t *p) {
7070
return (size_t)(1U << (*p >> 6));
7171
}
7272

73+
constuint8_t*nghttp3_get_varint(int64_t*dest, constuint8_t*p) {
74+
uint64_tn;
75+
76+
p=nghttp3_get_uvarint(&n, p);
77+
*dest= (int64_t)n;
78+
79+
returnp;
80+
}
81+
7382
uint8_t*nghttp3_put_uint64be(uint8_t*p, uint64_tn) {
7483
n=nghttp3_htonl64(n);
7584
returnnghttp3_cpymem(p, (constuint8_t*)&n, sizeof(n));

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_conv.hβ€Ž

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@
9292
# definentohs(N) _byteswap_ushort(N)
9393
#endif/* defined(WIN32) */
9494

95-
/*
96-
* nghttp3_get_uvarint reads variable-length unsigned integer from
97-
* |p|, and stores it in the buffer pointed by |dest| in host byte
98-
* order. It returns |p| plus the number of bytes read from |p|.
99-
*/
100-
constuint8_t*nghttp3_get_uvarint(uint64_t*dest, constuint8_t*p);
101-
102-
/*
103-
* nghttp3_get_uvarintlen returns the required number of bytes to read
104-
* variable-length integer starting at |p|.
105-
*/
106-
size_tnghttp3_get_uvarintlen(constuint8_t*p);
107-
108-
/*
109-
* nghttp3_get_varint reads variable-length unsigned integer from |p|,
110-
* and stores it in the buffer pointed by |dest| in host byte order.
111-
* It returns |p| plus the number of bytes read from |p|.
112-
*/
113-
staticinlineconstuint8_t*nghttp3_get_varint(int64_t*dest,
114-
constuint8_t*p) {
115-
uint64_tn;
116-
117-
p=nghttp3_get_uvarint(&n, p);
118-
*dest= (int64_t)n;
119-
120-
returnp;
121-
}
122-
12395
/*
12496
* nghttp3_put_uint64be writes |n| in host byte order in |p| in
12597
* network byte order. It returns the one beyond of the last written
@@ -141,18 +113,6 @@ uint8_t *nghttp3_put_uint32be(uint8_t *p, uint32_t n);
141113
*/
142114
uint8_t*nghttp3_put_uint16be(uint8_t*p, uint16_tn);
143115

144-
/*
145-
* nghttp3_put_uvarint writes |n| in |p| using variable-length integer
146-
* encoding. It returns the one beyond of the last written position.
147-
*/
148-
uint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
149-
150-
/*
151-
* nghttp3_put_uvarintlen returns the required number of bytes to
152-
* encode |n|.
153-
*/
154-
size_tnghttp3_put_uvarintlen(uint64_tn);
155-
156116
/*
157117
* nghttp3_ord_stream_id returns the ordinal number of |stream_id|.
158118
*/

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include"nghttp3_macro.h"
3737
#include"nghttp3_conv.h"
3838
#include"nghttp3_unreachable.h"
39+
#include"nghttp3_str.h"
3940
#include"sfparse/sfparse.h"
4041

41-
staticuint8_tdowncase(uint8_tc) {
42-
return'A' <= c&&c <= 'Z' ? (uint8_t)(c-'A'+'a') : c;
43-
}
44-
4542
/*
4643
* memieq returns 1 if the data pointed by |a| of length |n| equals to
4744
* |b| of the same length in case-insensitive manner. The data
@@ -52,7 +49,7 @@ static int memieq(const void *a, const void *b, size_t n) {
5249
constuint8_t*aa=a, *bb=b;
5350

5451
for (i=0; i<n; ++i) {
55-
if (aa[i] !=downcase(bb[i])) {
52+
if (aa[i] !=nghttp3_downcase_byte(bb[i])) {
5653
return0;
5754
}
5855
}
@@ -704,7 +701,7 @@ int nghttp3_check_header_name(const uint8_t *name, size_t len) {
704701
--len;
705702
}
706703
for (last=name+len; name!=last; ++name) {
707-
if (!VALID_HD_NAME_CHARS[*name]) {
704+
if (VALID_HD_NAME_CHARS[*name]!=1) {
708705
return0;
709706
}
710707
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uint8_t *nghttp3_qpack_huffman_encode(uint8_t *dest, const uint8_t *src,
8080
voidnghttp3_qpack_huffman_decode_context_init(
8181
nghttp3_qpack_huffman_decode_context*ctx) {
8282
*ctx= (nghttp3_qpack_huffman_decode_context){
83-
.flags=NGHTTP3_QPACK_HUFFMAN_ACCEPTED,
83+
.flags=NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED,
8484
};
8585
}
8686

@@ -103,20 +103,20 @@ nghttp3_qpack_huffman_decode(nghttp3_qpack_huffman_decode_context *ctx,
103103
for (; src!=end;) {
104104
c=*src++;
105105
t=qpack_huffman_decode_table[t.fstate][c >> 4];
106-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
106+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
107107
*p++=t.sym;
108108
}
109109

110110
t=qpack_huffman_decode_table[t.fstate][c&0xFU];
111-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
111+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
112112
*p++=t.sym;
113113
}
114114
}
115115

116116
ctx->fstate=t.fstate;
117117
ctx->flags=t.flags;
118118

119-
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_ACCEPTED)) {
119+
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED)) {
120120
returnNGHTTP3_ERR_QPACK_FATAL;
121121
}
122122

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_qpack_huffman.hβ€Ž

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@ size_t nghttp3_qpack_huffman_encode_count(const uint8_t *src, size_t len);
4646
uint8_t*nghttp3_qpack_huffman_encode(uint8_t*dest, constuint8_t*src,
4747
size_tsrclen);
4848

49-
typedefenumnghttp3_qpack_huffman_decode_flag {
50-
/* FSA accepts this state as the end of huffman encoding
51-
sequence. */
52-
NGHTTP3_QPACK_HUFFMAN_ACCEPTED=1,
53-
/* This state emits symbol */
54-
NGHTTP3_QPACK_HUFFMAN_SYM=1 << 1,
55-
} nghttp3_qpack_huffman_decode_flag;
49+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED indicates that FSA accepts this
50+
state as the end of huffman encoding sequence. */
51+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED 0x01U
52+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_SYM indicates that this state emits
53+
symbol */
54+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_SYM 0x02U
5655

5756
typedefstructnghttp3_qpack_huffman_decode_node {
5857
/* fstate is the current huffman decoding state, which is actually
5958
the node ID of internal huffman tree with
60-
nghttp3_qpack_huffman_decode_flag OR-ed. We have 257 leaf nodes,
61-
but they are identical to root node other than emitting a symbol,
62-
so we have 256 internal nodes [1..256], inclusive. The node ID
63-
256 is a special node and it is a terminal state that means
64-
decoding failed. */
59+
NGHTTP3_QPACK_HUFFMAN_FLAG_* flags OR-ed. We have 257 leaf
60+
nodes, but they are identical to root node other than emitting a
61+
symbol, so we have 256 internal nodes [1..256], inclusive. The
62+
node ID 256 is a special node and it is a terminal state that
63+
means decoding failed. */
6564
uint16_tfstate;
6665
uint8_tflags;
67-
/* symbol if NGHTTP3_QPACK_HUFFMAN_SYM flag set */
66+
/* symbol if NGHTTP3_QPACK_HUFFMAN_FLAG_SYM flag set */
6867
uint8_tsym;
6968
} nghttp3_qpack_huffman_decode_node;
7069

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 e3304cd

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update nghttp3 to 1.17.0
PR-URL: #64182 Backport-PR-URL: #64675 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
1 parent 345d6ad commit e3304cd

13 files changed

Lines changed: 4351 additions & 4265 deletions

β€Ždeps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.hβ€Ž

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,6 +2625,25 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
26252625
NGHTTP3_EXTERNintnghttp3_conn_add_write_offset(nghttp3_conn*conn,
26262626
int64_tstream_id, size_tn);
26272627

2628+
/**
2629+
* @function
2630+
*
2631+
* `nghttp3_conn_is_stream_flushed` returns nonzero if all stream data
2632+
* for a stream identified by |stream_id| so far have been accepted by
2633+
* QUIC stack. This means that the cumulative number of bytes that
2634+
* `nghttp3_conn_add_write_offset` notified covers all stream data
2635+
* currently held. This does not mean more stream data cannot be
2636+
* submitted to this stream via :type:`nghttp3_read_data_callback` and
2637+
* all stream data have been acknowledged.
2638+
*
2639+
* If there is no stream identified by |stream_id|, this function
2640+
* returns nonzero.
2641+
*
2642+
* .. version-added:: 1.17.0
2643+
*/
2644+
NGHTTP3_EXTERNintnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2645+
int64_tstream_id);
2646+
26282647
/**
26292648
* @function
26302649
*
@@ -3418,6 +3437,75 @@ NGHTTP3_EXTERN const nghttp3_info *nghttp3_version(int least_version);
34183437
*/
34193438
NGHTTP3_EXTERNintnghttp3_err_is_fatal(intliberr);
34203439

3440+
/**
3441+
* @function
3442+
*
3443+
* `nghttp3_get_uvarint` reads variable-length unsigned integer from
3444+
* the buffer pointed by |p|, and stores it in the object pointed by
3445+
* |dest| in host byte order. It returns |p| plus the number of bytes
3446+
* read from |p|. This function assumes that |p| points to the buffer
3447+
* that contains a valid variable-length unsigned integer. Use
3448+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3449+
* decode an integer.
3450+
*
3451+
* .. version-added:: 1.17.0
3452+
*/
3453+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_uvarint(uint64_t*dest,
3454+
constuint8_t*p);
3455+
3456+
/**
3457+
* @function
3458+
*
3459+
* `nghttp3_get_uvarintlen` returns the required number of bytes to
3460+
* read variable-length unsigned integer starting at |p|. |p| must
3461+
* not be NULL. This function only reads the single byte from the
3462+
* buffer pointed by |p|, and determines the number of bytes to read.
3463+
*
3464+
* .. version-added:: 1.17.0
3465+
*/
3466+
NGHTTP3_EXTERNsize_tnghttp3_get_uvarintlen(constuint8_t*p);
3467+
3468+
/**
3469+
* @function
3470+
*
3471+
* `nghttp3_get_varint` reads variable-length unsigned integer from
3472+
* the buffer pointed by |p|, and stores it in the object pointed by
3473+
* |dest| in host byte order. It returns |p| plus the number of bytes
3474+
* read from |p|. This function assumes that |p| points to the buffer
3475+
* that contains a valid variable-length unsigned integer. Use
3476+
* `nghttp3_get_uvarintlen` to get the number of bytes to successfully
3477+
* decode an integer.
3478+
*
3479+
* .. version-added:: 1.17.0
3480+
*/
3481+
NGHTTP3_EXTERNconstuint8_t*nghttp3_get_varint(int64_t*dest,
3482+
constuint8_t*p);
3483+
3484+
/**
3485+
* @function
3486+
*
3487+
* `nghttp3_put_uvarint` writes |n| to the buffer pointed by |p| using
3488+
* variable-length unsigned integer encoding. It returns the one
3489+
* beyond of the last written position. This function assumes that
3490+
* the buffer pointed by |p| has sufficient capacity to encode |n|.
3491+
* To know the required capacity, use `nghttp3_put_uvarintlen`. |n|
3492+
* must be less than or equal to (1 << 62) - 1.
3493+
*
3494+
* .. version-added:: 1.17.0
3495+
*/
3496+
NGHTTP3_EXTERNuint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
3497+
3498+
/**
3499+
* @function
3500+
*
3501+
* `nghttp3_put_uvarintlen` returns the required number of bytes to
3502+
* encode |n| in variable-length unsigned integer encoding. |n| must
3503+
* be less than or equal to (1 << 62) - 1.
3504+
*
3505+
* .. version-added:: 1.17.0
3506+
*/
3507+
NGHTTP3_EXTERNsize_tnghttp3_put_uvarintlen(uint64_tn);
3508+
34213509
/*
34223510
* Versioned function wrappers
34233511
*/

β€Ž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.16.0"
34+
#defineNGHTTP3_VERSION "1.17.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_NUM0x011000
44+
#defineNGHTTP3_VERSION_NUM0x011100
4545

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,3 +2979,25 @@ int nghttp3_conn_is_drained2(const nghttp3_conn *conn) {
29792979
nghttp3_stream_outq_write_done(conn->tx.ctrl) &&
29802980
nghttp3_ringbuf_len(&conn->tx.ctrl->frq) ==0;
29812981
}
2982+
2983+
intnghttp3_conn_is_stream_flushed(constnghttp3_conn*conn,
2984+
int64_tstream_id) {
2985+
nghttp3_stream*stream=nghttp3_conn_find_stream(conn, stream_id);
2986+
constnghttp3_frame*fr;
2987+
2988+
if (!stream) {
2989+
return1;
2990+
}
2991+
2992+
if (!nghttp3_stream_outq_write_done(stream)) {
2993+
return0;
2994+
}
2995+
2996+
if (nghttp3_ringbuf_len(&stream->frq) ==0) {
2997+
return1;
2998+
}
2999+
3000+
fr=nghttp3_ringbuf_get(&stream->frq, 0);
3001+
3002+
returnfr->hd.type==NGHTTP3_FRAME_DATA;
3003+
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ size_t nghttp3_get_uvarintlen(const uint8_t *p) {
7070
return (size_t)(1U << (*p >> 6));
7171
}
7272

73+
constuint8_t*nghttp3_get_varint(int64_t*dest, constuint8_t*p) {
74+
uint64_tn;
75+
76+
p=nghttp3_get_uvarint(&n, p);
77+
*dest= (int64_t)n;
78+
79+
returnp;
80+
}
81+
7382
uint8_t*nghttp3_put_uint64be(uint8_t*p, uint64_tn) {
7483
n=nghttp3_htonl64(n);
7584
returnnghttp3_cpymem(p, (constuint8_t*)&n, sizeof(n));

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_conv.hβ€Ž

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,6 @@
9292
# definentohs(N) _byteswap_ushort(N)
9393
#endif/* defined(WIN32) */
9494

95-
/*
96-
* nghttp3_get_uvarint reads variable-length unsigned integer from
97-
* |p|, and stores it in the buffer pointed by |dest| in host byte
98-
* order. It returns |p| plus the number of bytes read from |p|.
99-
*/
100-
constuint8_t*nghttp3_get_uvarint(uint64_t*dest, constuint8_t*p);
101-
102-
/*
103-
* nghttp3_get_uvarintlen returns the required number of bytes to read
104-
* variable-length integer starting at |p|.
105-
*/
106-
size_tnghttp3_get_uvarintlen(constuint8_t*p);
107-
108-
/*
109-
* nghttp3_get_varint reads variable-length unsigned integer from |p|,
110-
* and stores it in the buffer pointed by |dest| in host byte order.
111-
* It returns |p| plus the number of bytes read from |p|.
112-
*/
113-
staticinlineconstuint8_t*nghttp3_get_varint(int64_t*dest,
114-
constuint8_t*p) {
115-
uint64_tn;
116-
117-
p=nghttp3_get_uvarint(&n, p);
118-
*dest= (int64_t)n;
119-
120-
returnp;
121-
}
122-
12395
/*
12496
* nghttp3_put_uint64be writes |n| in host byte order in |p| in
12597
* network byte order. It returns the one beyond of the last written
@@ -141,18 +113,6 @@ uint8_t *nghttp3_put_uint32be(uint8_t *p, uint32_t n);
141113
*/
142114
uint8_t*nghttp3_put_uint16be(uint8_t*p, uint16_tn);
143115

144-
/*
145-
* nghttp3_put_uvarint writes |n| in |p| using variable-length integer
146-
* encoding. It returns the one beyond of the last written position.
147-
*/
148-
uint8_t*nghttp3_put_uvarint(uint8_t*p, uint64_tn);
149-
150-
/*
151-
* nghttp3_put_uvarintlen returns the required number of bytes to
152-
* encode |n|.
153-
*/
154-
size_tnghttp3_put_uvarintlen(uint64_tn);
155-
156116
/*
157117
* nghttp3_ord_stream_id returns the ordinal number of |stream_id|.
158118
*/

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include"nghttp3_macro.h"
3737
#include"nghttp3_conv.h"
3838
#include"nghttp3_unreachable.h"
39+
#include"nghttp3_str.h"
3940
#include"sfparse/sfparse.h"
4041

41-
staticuint8_tdowncase(uint8_tc) {
42-
return'A' <= c&&c <= 'Z' ? (uint8_t)(c-'A'+'a') : c;
43-
}
44-
4542
/*
4643
* memieq returns 1 if the data pointed by |a| of length |n| equals to
4744
* |b| of the same length in case-insensitive manner. The data
@@ -52,7 +49,7 @@ static int memieq(const void *a, const void *b, size_t n) {
5249
constuint8_t*aa=a, *bb=b;
5350

5451
for (i=0; i<n; ++i) {
55-
if (aa[i] !=downcase(bb[i])) {
52+
if (aa[i] !=nghttp3_downcase_byte(bb[i])) {
5653
return0;
5754
}
5855
}
@@ -704,7 +701,7 @@ int nghttp3_check_header_name(const uint8_t *name, size_t len) {
704701
--len;
705702
}
706703
for (last=name+len; name!=last; ++name) {
707-
if (!VALID_HD_NAME_CHARS[*name]) {
704+
if (VALID_HD_NAME_CHARS[*name]!=1) {
708705
return0;
709706
}
710707
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ uint8_t *nghttp3_qpack_huffman_encode(uint8_t *dest, const uint8_t *src,
8080
voidnghttp3_qpack_huffman_decode_context_init(
8181
nghttp3_qpack_huffman_decode_context*ctx) {
8282
*ctx= (nghttp3_qpack_huffman_decode_context){
83-
.flags=NGHTTP3_QPACK_HUFFMAN_ACCEPTED,
83+
.flags=NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED,
8484
};
8585
}
8686

@@ -103,20 +103,20 @@ nghttp3_qpack_huffman_decode(nghttp3_qpack_huffman_decode_context *ctx,
103103
for (; src!=end;) {
104104
c=*src++;
105105
t=qpack_huffman_decode_table[t.fstate][c >> 4];
106-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
106+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
107107
*p++=t.sym;
108108
}
109109

110110
t=qpack_huffman_decode_table[t.fstate][c&0xFU];
111-
if (t.flags&NGHTTP3_QPACK_HUFFMAN_SYM) {
111+
if (t.flags&NGHTTP3_QPACK_HUFFMAN_FLAG_SYM) {
112112
*p++=t.sym;
113113
}
114114
}
115115

116116
ctx->fstate=t.fstate;
117117
ctx->flags=t.flags;
118118

119-
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_ACCEPTED)) {
119+
if (fin&& !(ctx->flags&NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED)) {
120120
returnNGHTTP3_ERR_QPACK_FATAL;
121121
}
122122

β€Ždeps/ngtcp2/nghttp3/lib/nghttp3_qpack_huffman.hβ€Ž

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@ size_t nghttp3_qpack_huffman_encode_count(const uint8_t *src, size_t len);
4646
uint8_t*nghttp3_qpack_huffman_encode(uint8_t*dest, constuint8_t*src,
4747
size_tsrclen);
4848

49-
typedefenumnghttp3_qpack_huffman_decode_flag {
50-
/* FSA accepts this state as the end of huffman encoding
51-
sequence. */
52-
NGHTTP3_QPACK_HUFFMAN_ACCEPTED=1,
53-
/* This state emits symbol */
54-
NGHTTP3_QPACK_HUFFMAN_SYM=1 << 1,
55-
} nghttp3_qpack_huffman_decode_flag;
49+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED indicates that FSA accepts this
50+
state as the end of huffman encoding sequence. */
51+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_ACCEPTED 0x01U
52+
/* NGHTTP3_QPACK_HUFFMAN_FLAG_SYM indicates that this state emits
53+
symbol */
54+
#defineNGHTTP3_QPACK_HUFFMAN_FLAG_SYM 0x02U
5655

5756
typedefstructnghttp3_qpack_huffman_decode_node {
5857
/* fstate is the current huffman decoding state, which is actually
5958
the node ID of internal huffman tree with
60-
nghttp3_qpack_huffman_decode_flag OR-ed. We have 257 leaf nodes,
61-
but they are identical to root node other than emitting a symbol,
62-
so we have 256 internal nodes [1..256], inclusive. The node ID
63-
256 is a special node and it is a terminal state that means
64-
decoding failed. */
59+
NGHTTP3_QPACK_HUFFMAN_FLAG_* flags OR-ed. We have 257 leaf
60+
nodes, but they are identical to root node other than emitting a
61+
symbol, so we have 256 internal nodes [1..256], inclusive. The
62+
node ID 256 is a special node and it is a terminal state that
63+
means decoding failed. */
6564
uint16_tfstate;
6665
uint8_tflags;
67-
/* symbol if NGHTTP3_QPACK_HUFFMAN_SYM flag set */
66+
/* symbol if NGHTTP3_QPACK_HUFFMAN_FLAG_SYM flag set */
6867
uint8_tsym;
6968
} nghttp3_qpack_huffman_decode_node;
7069

0 commit comments

Comments
Β (0)