Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update nghttp3 to 1.7.0 #56333

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* Version number of the nghttp3 library release.
*/
#define NGHTTP3_VERSION "1.6.0"
#define NGHTTP3_VERSION "1.7.0"

/**
* @macro
Expand All @@ -41,6 +41,6 @@
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
* becomes 0x010203.
*/
#define NGHTTP3_VERSION_NUM 0x010600
#define NGHTTP3_VERSION_NUM 0x010700

#endif /* !defined(NGHTTP3_VERSION_H) */
2 changes: 1 addition & 1 deletion deps/ngtcp2/nghttp3/lib/nghttp3_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
dynamic table capacity that QPACK encoder is willing to use. */
#define NGHTTP3_QPACK_ENCODER_MAX_DTABLE_CAPACITY 4096

nghttp3_objalloc_def(chunk, nghttp3_chunk, oplent);
nghttp3_objalloc_def(chunk, nghttp3_chunk, oplent)

/*
* conn_remote_stream_uni returns nonzero if |stream_id| is remote
Expand Down
2 changes: 1 addition & 1 deletion deps/ngtcp2/nghttp3/lib/nghttp3_conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ typedef struct nghttp3_chunk {
nghttp3_opl_entry oplent;
} nghttp3_chunk;

nghttp3_objalloc_decl(chunk, nghttp3_chunk, oplent);
nghttp3_objalloc_decl(chunk, nghttp3_chunk, oplent)

struct nghttp3_conn {
nghttp3_objalloc out_chunk_objalloc;
Expand Down
16 changes: 8 additions & 8 deletions deps/ngtcp2/nghttp3/lib/nghttp3_gaptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#include <assert.h>

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

gaptr->mem = mem;
}
Expand Down Expand Up @@ -62,8 +62,8 @@ int nghttp3_gaptr_push(nghttp3_gaptr *gaptr, uint64_t offset,
}
}

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

for (; !nghttp3_ksl_it_end(&it);) {
k = *(nghttp3_range *)nghttp3_ksl_it_key(&it);
Expand Down Expand Up @@ -120,8 +120,8 @@ nghttp3_range nghttp3_gaptr_get_first_gap_after(nghttp3_gaptr *gaptr,
return r;
}

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

assert(!nghttp3_ksl_it_end(&it));

Expand All @@ -138,8 +138,8 @@ int nghttp3_gaptr_is_pushed(nghttp3_gaptr *gaptr, uint64_t offset,
return 0;
}

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

return nghttp3_range_len(&m) == 0;
Expand Down
19 changes: 10 additions & 9 deletions deps/ngtcp2/nghttp3/lib/nghttp3_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@ static int is_ws(uint8_t c) {
int nghttp3_http_parse_priority(nghttp3_pri *dest, const uint8_t *value,
size_t valuelen) {
nghttp3_pri pri = *dest;
sf_parser sfp;
sf_vec key;
sf_value val;
sfparse_parser sfp;
sfparse_vec key;
sfparse_value val;
int rv;

sf_parser_init(&sfp, value, valuelen);
sfparse_parser_init(&sfp, value, valuelen);

for (;;) {
rv = sf_parser_dict(&sfp, &key, &val);
rv = sfparse_parser_dict(&sfp, &key, &val);
if (rv != 0) {
if (rv == SF_ERR_EOF) {
if (rv == SFPARSE_ERR_EOF) {
break;
}

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

switch (key.base[0]) {
case 'i':
if (val.type != SF_TYPE_BOOLEAN) {
if (val.type != SFPARSE_TYPE_BOOLEAN) {
return NGHTTP3_ERR_INVALID_ARGUMENT;
}

pri.inc = (uint8_t)val.boolean;

break;
case 'u':
if (val.type != SF_TYPE_INTEGER || val.integer < NGHTTP3_URGENCY_HIGH ||
if (val.type != SFPARSE_TYPE_INTEGER ||
val.integer < NGHTTP3_URGENCY_HIGH ||
NGHTTP3_URGENCY_LOW < val.integer) {
return NGHTTP3_ERR_INVALID_ARGUMENT;
}
Expand Down Expand Up @@ -197,7 +198,7 @@ static char VALID_AUTHORITY_CHARS[] = {
1 /* 4 */, 1 /* 5 */, 1 /* 6 */, 1 /* 7 */,
1 /* 8 */, 1 /* 9 */, 1 /* : */, 1 /* ; */,
0 /* < */, 1 /* = */, 0 /* > */, 0 /* ? */,
1 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */,
0 /* @ */, 1 /* A */, 1 /* B */, 1 /* C */,
1 /* D */, 1 /* E */, 1 /* F */, 1 /* G */,
1 /* H */, 1 /* I */, 1 /* J */, 1 /* K */,
1 /* L */, 1 /* M */, 1 /* N */, 1 /* O */,
Expand Down
75 changes: 52 additions & 23 deletions deps/ngtcp2/nghttp3/lib/nghttp3_ksl.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

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

nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent);
nghttp3_objalloc_def(ksl_blk, nghttp3_ksl_blk, oplent)

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

void nghttp3_ksl_init(nghttp3_ksl *ksl, nghttp3_ksl_compar compar,
size_t keylen, const nghttp3_mem *mem) {
nghttp3_ksl_search search, size_t keylen,
const nghttp3_mem *mem) {
size_t nodelen = ksl_nodelen(keylen);

nghttp3_objalloc_init(&ksl->blkalloc,
Expand All @@ -68,6 +69,7 @@ void nghttp3_ksl_init(nghttp3_ksl *ksl, nghttp3_ksl_compar compar,
ksl->head = NULL;
ksl->front = ksl->back = NULL;
ksl->compar = compar;
ksl->search = search;
ksl->n = 0;
ksl->keylen = keylen;
ksl->nodelen = nodelen;
Expand Down Expand Up @@ -274,20 +276,6 @@ static void ksl_insert_node(nghttp3_ksl *ksl, nghttp3_ksl_blk *blk, size_t i,
++blk->n;
}

static size_t ksl_search(const nghttp3_ksl *ksl, nghttp3_ksl_blk *blk,
const nghttp3_ksl_key *key,
nghttp3_ksl_compar compar) {
size_t i;
nghttp3_ksl_node *node;

for (i = 0, node = (nghttp3_ksl_node *)(void *)blk->nodes;
i < blk->n && compar((nghttp3_ksl_key *)node->key, key);
++i, node = (nghttp3_ksl_node *)(void *)((uint8_t *)node + ksl->nodelen))
;

return i;
}

int nghttp3_ksl_insert(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
const nghttp3_ksl_key *key, void *data) {
nghttp3_ksl_blk *blk;
Expand All @@ -312,7 +300,7 @@ int nghttp3_ksl_insert(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
blk = ksl->head;

for (;;) {
i = ksl_search(ksl, blk, key, ksl->compar);
i = ksl->search(ksl, blk, key);

if (blk->leaf) {
if (i < blk->n &&
Expand Down Expand Up @@ -571,7 +559,7 @@ int nghttp3_ksl_remove(nghttp3_ksl *ksl, nghttp3_ksl_it *it,
}

for (;;) {
i = ksl_search(ksl, blk, key, ksl->compar);
i = ksl->search(ksl, blk, key);

if (i == blk->n) {
if (it) {
Expand Down Expand Up @@ -642,12 +630,12 @@ int nghttp3_ksl_remove(nghttp3_ksl *ksl, nghttp3_ksl_it *it,

nghttp3_ksl_it nghttp3_ksl_lower_bound(const nghttp3_ksl *ksl,
const nghttp3_ksl_key *key) {
return nghttp3_ksl_lower_bound_compar(ksl, key, ksl->compar);
return nghttp3_ksl_lower_bound_search(ksl, key, ksl->search);
}

nghttp3_ksl_it nghttp3_ksl_lower_bound_compar(const nghttp3_ksl *ksl,
nghttp3_ksl_it nghttp3_ksl_lower_bound_search(const nghttp3_ksl *ksl,
const nghttp3_ksl_key *key,
nghttp3_ksl_compar compar) {
nghttp3_ksl_search search) {
nghttp3_ksl_blk *blk = ksl->head;
nghttp3_ksl_it it;
size_t i;
Expand All @@ -658,7 +646,7 @@ nghttp3_ksl_it nghttp3_ksl_lower_bound_compar(const nghttp3_ksl *ksl,
}

for (;;) {
i = ksl_search(ksl, blk, key, compar);
i = search(ksl, blk, key);

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

for (;;) {
i = ksl_search(ksl, blk, old_key, ksl->compar);
i = ksl->search(ksl, blk, old_key);

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

nghttp3_ksl_search_def(range, nghttp3_ksl_range_compar)

size_t nghttp3_ksl_range_search(const nghttp3_ksl *ksl, nghttp3_ksl_blk *blk,
const nghttp3_ksl_key *key) {
return ksl_range_search(ksl, blk, key);
}

int nghttp3_ksl_range_exclusive_compar(const nghttp3_ksl_key *lhs,
const nghttp3_ksl_key *rhs) {
const nghttp3_range *a = lhs, *b = rhs;
return a->begin < b->begin && !(nghttp3_max_uint64(a->begin, b->begin) <
nghttp3_min_uint64(a->end, b->end));
}

nghttp3_ksl_search_def(range_exclusive, nghttp3_ksl_range_exclusive_compar)

size_t nghttp3_ksl_range_exclusive_search(const nghttp3_ksl *ksl,
nghttp3_ksl_blk *blk,
const nghttp3_ksl_key *key) {
return ksl_range_exclusive_search(ksl, blk, key);
}

int nghttp3_ksl_uint64_less(const nghttp3_ksl_key *lhs,
const nghttp3_ksl_key *rhs) {
return *(uint64_t *)lhs < *(uint64_t *)rhs;
}

nghttp3_ksl_search_def(uint64_less, nghttp3_ksl_uint64_less)

size_t nghttp3_ksl_uint64_less_search(const nghttp3_ksl *ksl,
nghttp3_ksl_blk *blk,
const nghttp3_ksl_key *key) {
return ksl_uint64_less_search(ksl, blk, key);
}

int nghttp3_ksl_int64_greater(const nghttp3_ksl_key *lhs,
const nghttp3_ksl_key *rhs) {
return *(int64_t *)lhs > *(int64_t *)rhs;
}

nghttp3_ksl_search_def(int64_greater, nghttp3_ksl_int64_greater)

size_t nghttp3_ksl_int64_greater_search(const nghttp3_ksl *ksl,
nghttp3_ksl_blk *blk,
const nghttp3_ksl_key *key) {
return ksl_int64_greater_search(ksl, blk, key);
}
Loading
Loading