Skip to content

Commit 3b458da

Browse files
deps: update nghttp3 to 1.7.0
1 parent 7119303 commit 3b458da

File tree

14 files changed

+828
-430
lines changed

14 files changed

+828
-430
lines changed

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

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

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

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

deps/ngtcp2/nghttp3/lib/nghttp3_conn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
dynamic table capacity that QPACK encoder is willing to use. */
4040
#define NGHTTP3_QPACK_ENCODER_MAX_DTABLE_CAPACITY 4096
4141

42-
nghttp3_objalloc_def(chunk, nghttp3_chunk, oplent);
42+
nghttp3_objalloc_def(chunk, nghttp3_chunk, oplent)
4343

4444
/*
4545
* conn_remote_stream_uni returns nonzero if |stream_id| is remote

deps/ngtcp2/nghttp3/lib/nghttp3_conn.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ typedef struct nghttp3_chunk {
7676
nghttp3_opl_entry oplent;
7777
} nghttp3_chunk;
7878

79-
nghttp3_objalloc_decl(chunk, nghttp3_chunk, oplent);
79+
nghttp3_objalloc_decl(chunk, nghttp3_chunk, oplent)
8080

8181
struct nghttp3_conn {
8282
nghttp3_objalloc out_chunk_objalloc;

deps/ngtcp2/nghttp3/lib/nghttp3_gaptr.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
#include <assert.h>
3030

3131
void nghttp3_gaptr_init(nghttp3_gaptr *gaptr, const nghttp3_mem *mem) {
32-
nghttp3_ksl_init(&gaptr->gap, nghttp3_ksl_range_compar, sizeof(nghttp3_range),
33-
mem);
32+
nghttp3_ksl_init(&gaptr->gap, nghttp3_ksl_range_compar,
33+
nghttp3_ksl_range_search, sizeof(nghttp3_range), mem);
3434

3535
gaptr->mem = mem;
3636
}
@@ -62,8 +62,8 @@ int nghttp3_gaptr_push(nghttp3_gaptr *gaptr, uint64_t offset,
6262
}
6363
}
6464

65-
it = nghttp3_ksl_lower_bound_compar(&gaptr->gap, &q,
66-
nghttp3_ksl_range_exclusive_compar);
65+
it = nghttp3_ksl_lower_bound_search(&gaptr->gap, &q,
66+
nghttp3_ksl_range_exclusive_search);
6767

6868
for (; !nghttp3_ksl_it_end(&it);) {
6969
k = *(nghttp3_range *)nghttp3_ksl_it_key(&it);
@@ -120,8 +120,8 @@ nghttp3_range nghttp3_gaptr_get_first_gap_after(nghttp3_gaptr *gaptr,
120120
return r;
121121
}
122122

123-
it = nghttp3_ksl_lower_bound_compar(&gaptr->gap, &q,
124-
nghttp3_ksl_range_exclusive_compar);
123+
it = nghttp3_ksl_lower_bound_search(&gaptr->gap, &q,
124+
nghttp3_ksl_range_exclusive_search);
125125

126126
assert(!nghttp3_ksl_it_end(&it));
127127

@@ -138,8 +138,8 @@ int nghttp3_gaptr_is_pushed(nghttp3_gaptr *gaptr, uint64_t offset,
138138
return 0;
139139
}
140140

141-
it = nghttp3_ksl_lower_bound_compar(&gaptr->gap, &q,
142-
nghttp3_ksl_range_exclusive_compar);
141+
it = nghttp3_ksl_lower_bound_search(&gaptr->gap, &q,
142+
nghttp3_ksl_range_exclusive_search);
143143
m = nghttp3_range_intersect(&q, (nghttp3_range *)nghttp3_ksl_it_key(&it));
144144

145145
return nghttp3_range_len(&m) == 0;

deps/ngtcp2/nghttp3/lib/nghttp3_http.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,17 @@ static int is_ws(uint8_t c) {
124124
int nghttp3_http_parse_priority(nghttp3_pri *dest, const uint8_t *value,
125125
size_t valuelen) {
126126
nghttp3_pri pri = *dest;
127-
sf_parser sfp;
128-
sf_vec key;
129-
sf_value val;
127+
sfparse_parser sfp;
128+
sfparse_vec key;
129+
sfparse_value val;
130130
int rv;
131131

132-
sf_parser_init(&sfp, value, valuelen);
132+
sfparse_parser_init(&sfp, value, valuelen);
133133

134134
for (;;) {
135-
rv = sf_parser_dict(&sfp, &key, &val);
135+
rv = sfparse_parser_dict(&sfp, &key, &val);
136136
if (rv != 0) {
137-
if (rv == SF_ERR_EOF) {
137+
if (rv == SFPARSE_ERR_EOF) {
138138
break;
139139
}
140140

@@ -147,15 +147,16 @@ int nghttp3_http_parse_priority(nghttp3_pri *dest, const uint8_t *value,
147147

148148
switch (key.base[0]) {
149149
case 'i':
150-
if (val.type != SF_TYPE_BOOLEAN) {
150+
if (val.type != SFPARSE_TYPE_BOOLEAN) {
151151
return NGHTTP3_ERR_INVALID_ARGUMENT;
152152
}
153153

154154
pri.inc = (uint8_t)val.boolean;
155155

156156
break;
157157
case 'u':
158-
if (val.type != SF_TYPE_INTEGER || val.integer < NGHTTP3_URGENCY_HIGH ||
158+
if (val.type != SFPARSE_TYPE_INTEGER ||
159+
val.integer < NGHTTP3_URGENCY_HIGH ||
159160
NGHTTP3_URGENCY_LOW < val.integer) {
160161
return NGHTTP3_ERR_INVALID_ARGUMENT;
161162
}
@@ -197,7 +198,7 @@ static char VALID_AUTHORITY_CHARS[] = {
197198
1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */,
198199
1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */,
199200
0 /* < */, 1 /* = */, 0 /* > */, 0 /* ? */,
200-
1 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */,
201+
0 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */,
201202
1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */,
202203
1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */,
203204
1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */,

deps/ngtcp2/nghttp3/lib/nghttp3_ksl.c

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
static nghttp3_ksl_blk null_blk = {{{NULL, NULL, 0, 0, {0}}}};
3838

39-
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent);
39+
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)
4040

4141
static size_t ksl_nodelen(size_t keylen) {
4242
assert(keylen >= sizeof(uint64_t));
@@ -59,7 +59,8 @@ static void ksl_node_set_key(nghttp3_ksl *ksl, nghttp3_ksl_node *node,
5959
}
6060

6161
void nghttp3_ksl_init(nghttp3_ksl *ksl, nghttp3_ksl_compar compar,
62-
size_t keylen, const nghttp3_mem *mem) {
62+
nghttp3_ksl_search search, size_t keylen,
63+
const nghttp3_mem *mem) {
6364
size_t nodelen = ksl_nodelen(keylen);
6465

6566
nghttp3_objalloc_init(&ksl->blkalloc,
@@ -68,6 +69,7 @@ void nghttp3_ksl_init(nghttp3_ksl *ksl, nghttp3_ksl_compar compar,
6869
ksl->head = NULL;
6970
ksl->front = ksl->back = NULL;
7071
ksl->compar = compar;
72+
ksl->search = search;
7173
ksl->n = 0;
7274
ksl->keylen = keylen;
7375
ksl->nodelen = nodelen;
@@ -274,20 +276,6 @@ static void ksl_insert_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i,
274276
++blk->n;
275277
}
276278

277-
static size_t ksl_search(const nghttp3_ksl *ksl, nghttp3_ksl_blk *blk,
278-
const nghttp3_ksl_key *key,
279-
nghttp3_ksl_compar compar) {
280-
size_t i;
281-
nghttp3_ksl_node *node;
282-
283-
for (i = 0, node = (nghttp3_ksl_node *)(void *)blk->nodes;
284-
i < blk->n && compar((nghttp3_ksl_key *)node->key, key);
285-
++i, node = (nghttp3_ksl_node *)(void *)((uint8_t *)node + ksl->nodelen))
286-
;
287-
288-
return i;
289-
}
290-
291279
int nghttp3_ksl_insert(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
292280
const nghttp3_ksl_key *key, void *data) {
293281
nghttp3_ksl_blk *blk;
@@ -312,7 +300,7 @@ int nghttp3_ksl_insert(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
312300
blk = ksl->head;
313301

314302
for (;;) {
315-
i = ksl_search(ksl, blk, key, ksl->compar);
303+
i = ksl->search(ksl, blk, key);
316304

317305
if (blk->leaf) {
318306
if (i < blk->n &&
@@ -571,7 +559,7 @@ int nghttp3_ksl_remove(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
571559
}
572560

573561
for (;;) {
574-
i = ksl_search(ksl, blk, key, ksl->compar);
562+
i = ksl->search(ksl, blk, key);
575563

576564
if (i == blk->n) {
577565
if (it) {
@@ -642,12 +630,12 @@ int nghttp3_ksl_remove(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
642630

643631
nghttp3_ksl_it nghttp3_ksl_lower_bound(const nghttp3_ksl *ksl,
644632
const nghttp3_ksl_key *key) {
645-
return nghttp3_ksl_lower_bound_compar(ksl, key, ksl->compar);
633+
return nghttp3_ksl_lower_bound_search(ksl, key, ksl->search);
646634
}
647635

648-
nghttp3_ksl_it nghttp3_ksl_lower_bound_compar(const nghttp3_ksl *ksl,
636+
nghttp3_ksl_it nghttp3_ksl_lower_bound_search(const nghttp3_ksl *ksl,
649637
const nghttp3_ksl_key *key,
650-
nghttp3_ksl_compar compar) {
638+
nghttp3_ksl_search search) {
651639
nghttp3_ksl_blk *blk = ksl->head;
652640
nghttp3_ksl_it it;
653641
size_t i;
@@ -658,7 +646,7 @@ nghttp3_ksl_it nghttp3_ksl_lower_bound_compar(const nghttp3_ksl *ksl,
658646
}
659647

660648
for (;;) {
661-
i = ksl_search(ksl, blk, key, compar);
649+
i = search(ksl, blk, key);
662650

663651
if (blk->leaf) {
664652
if (i == blk->n && blk->next) {
@@ -702,7 +690,7 @@ void nghttp3_ksl_update_key(nghttp3_ksl *ksl, const nghttp3_ksl_key *old_key,
702690
assert(ksl->head);
703691

704692
for (;;) {
705-
i = ksl_search(ksl, blk, old_key, ksl->compar);
693+
i = ksl->search(ksl, blk, old_key);
706694

707695
assert(i < blk->n);
708696
node = nghttp3_ksl_nth_node(ksl, blk, i);
@@ -825,9 +813,50 @@ int nghttp3_ksl_range_compar(const nghttp3_ksl_key *lhs,
825813
return a->begin < b->begin;
826814
}
827815

816+
nghttp3_ksl_search_def(range, nghttp3_ksl_range_compar)
817+
818+
size_t nghttp3_ksl_range_search(const nghttp3_ksl *ksl, nghttp3_ksl_blk *blk,
819+
const nghttp3_ksl_key *key) {
820+
return ksl_range_search(ksl, blk, key);
821+
}
822+
828823
int nghttp3_ksl_range_exclusive_compar(const nghttp3_ksl_key *lhs,
829824
const nghttp3_ksl_key *rhs) {
830825
const nghttp3_range *a = lhs, *b = rhs;
831826
return a->begin < b->begin && !(nghttp3_max_uint64(a->begin, b->begin) <
832827
nghttp3_min_uint64(a->end, b->end));
833828
}
829+
830+
nghttp3_ksl_search_def(range_exclusive, nghttp3_ksl_range_exclusive_compar)
831+
832+
size_t nghttp3_ksl_range_exclusive_search(const nghttp3_ksl *ksl,
833+
nghttp3_ksl_blk *blk,
834+
const nghttp3_ksl_key *key) {
835+
return ksl_range_exclusive_search(ksl, blk, key);
836+
}
837+
838+
int nghttp3_ksl_uint64_less(const nghttp3_ksl_key *lhs,
839+
const nghttp3_ksl_key *rhs) {
840+
return *(uint64_t *)lhs < *(uint64_t *)rhs;
841+
}
842+
843+
nghttp3_ksl_search_def(uint64_less, nghttp3_ksl_uint64_less)
844+
845+
size_t nghttp3_ksl_uint64_less_search(const nghttp3_ksl *ksl,
846+
nghttp3_ksl_blk *blk,
847+
const nghttp3_ksl_key *key) {
848+
return ksl_uint64_less_search(ksl, blk, key);
849+
}
850+
851+
int nghttp3_ksl_int64_greater(const nghttp3_ksl_key *lhs,
852+
const nghttp3_ksl_key *rhs) {
853+
return *(int64_t *)lhs > *(int64_t *)rhs;
854+
}
855+
856+
nghttp3_ksl_search_def(int64_greater, nghttp3_ksl_int64_greater)
857+
858+
size_t nghttp3_ksl_int64_greater_search(const nghttp3_ksl *ksl,
859+
nghttp3_ksl_blk *blk,
860+
const nghttp3_ksl_key *key) {
861+
return ksl_int64_greater_search(ksl, blk, key);
862+
}

0 commit comments

Comments
 (0)