Skip to content

Commit fc94992

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update nghttp2 to 1.62.0
PR-URL: #52966 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ulises Gascón <[email protected]>
1 parent ec83431 commit fc94992

13 files changed

+74
-44
lines changed

deps/nghttp2/lib/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ EXTRACFLAG = @EXTRACFLAG@
328328
EXTRA_DEFS = @EXTRA_DEFS@
329329
FGREP = @FGREP@
330330
GREP = @GREP@
331-
HAVE_CXX14 = @HAVE_CXX14@
331+
HAVE_CXX20 = @HAVE_CXX20@
332332
INSTALL = @INSTALL@
333333
INSTALL_DATA = @INSTALL_DATA@
334334
INSTALL_PROGRAM = @INSTALL_PROGRAM@

deps/nghttp2/lib/includes/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ EXTRACFLAG = @EXTRACFLAG@
233233
EXTRA_DEFS = @EXTRA_DEFS@
234234
FGREP = @FGREP@
235235
GREP = @GREP@
236-
HAVE_CXX14 = @HAVE_CXX14@
236+
HAVE_CXX20 = @HAVE_CXX20@
237237
INSTALL = @INSTALL@
238238
INSTALL_DATA = @INSTALL_DATA@
239239
INSTALL_PROGRAM = @INSTALL_PROGRAM@

deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
* @macro
3030
* Version number of the nghttp2 library release
3131
*/
32-
#define NGHTTP2_VERSION "1.61.0"
32+
#define NGHTTP2_VERSION "1.62.0"
3333

3434
/**
3535
* @macro
3636
* Numerical representation of the version number of the nghttp2 library
3737
* release. This is a 24 bit number with 8 bits for major number, 8 bits
3838
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
3939
*/
40-
#define NGHTTP2_VERSION_NUM 0x013d00
40+
#define NGHTTP2_VERSION_NUM 0x013e00
4141

4242
#endif /* NGHTTP2VER_H */

deps/nghttp2/lib/nghttp2_buf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int nghttp2_buf_reserve(nghttp2_buf *buf, size_t new_cap, nghttp2_mem *mem) {
6161
return 0;
6262
}
6363

64-
new_cap = nghttp2_max(new_cap, cap * 2);
64+
new_cap = nghttp2_max_size(new_cap, cap * 2);
6565

6666
ptr = nghttp2_mem_realloc(mem, buf->begin, new_cap);
6767
if (ptr == NULL) {
@@ -343,7 +343,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) {
343343
while (len) {
344344
buf = &bufs->cur->buf;
345345

346-
nwrite = nghttp2_min(nghttp2_buf_avail(buf), len);
346+
nwrite = nghttp2_min_size(nghttp2_buf_avail(buf), len);
347347
if (nwrite == 0) {
348348
rv = bufs_alloc_chain(bufs);
349349
if (rv != 0) {

deps/nghttp2/lib/nghttp2_hd.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,13 +1245,13 @@ static void hd_context_shrink_table_size(nghttp2_hd_context *context,
12451245

12461246
int nghttp2_hd_deflate_change_table_size(
12471247
nghttp2_hd_deflater *deflater, size_t settings_max_dynamic_table_size) {
1248-
size_t next_bufsize = nghttp2_min(settings_max_dynamic_table_size,
1249-
deflater->deflate_hd_table_bufsize_max);
1248+
size_t next_bufsize = nghttp2_min_size(
1249+
settings_max_dynamic_table_size, deflater->deflate_hd_table_bufsize_max);
12501250

12511251
deflater->ctx.hd_table_bufsize_max = next_bufsize;
12521252

12531253
deflater->min_hd_table_bufsize_max =
1254-
nghttp2_min(deflater->min_hd_table_bufsize_max, next_bufsize);
1254+
nghttp2_min_size(deflater->min_hd_table_bufsize_max, next_bufsize);
12551255

12561256
deflater->notify_table_size_change = 1;
12571257

@@ -1738,7 +1738,7 @@ static nghttp2_ssize hd_inflate_read_huff(nghttp2_hd_inflater *inflater,
17381738
static nghttp2_ssize hd_inflate_read(nghttp2_hd_inflater *inflater,
17391739
nghttp2_buf *buf, const uint8_t *in,
17401740
const uint8_t *last) {
1741-
size_t len = nghttp2_min((size_t)(last - in), inflater->left);
1741+
size_t len = nghttp2_min_size((size_t)(last - in), inflater->left);
17421742

17431743
buf->last = nghttp2_cpymem(buf->last, in, len);
17441744

@@ -1962,8 +1962,8 @@ nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
19621962
rfin = 0;
19631963
rv = hd_inflate_read_len(
19641964
inflater, &rfin, in, last, 5,
1965-
nghttp2_min(inflater->min_hd_table_bufsize_max,
1966-
inflater->settings_hd_table_bufsize_max));
1965+
nghttp2_min_size(inflater->min_hd_table_bufsize_max,
1966+
inflater->settings_hd_table_bufsize_max));
19671967
if (rv < 0) {
19681968
goto fail;
19691969
}

deps/nghttp2/lib/nghttp2_hd_huffman.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ nghttp2_ssize nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx,
116116
uint8_t c;
117117

118118
/* We use the decoding algorithm described in
119-
http://graphics.ics.uci.edu/pub/Prefix.pdf */
119+
- http://graphics.ics.uci.edu/pub/Prefix.pdf [!!! NO LONGER VALID !!!]
120+
- https://ics.uci.edu/~dan/pubs/Prefix.pdf
121+
- https://github.com/nghttp2/nghttp2/files/15141264/Prefix.pdf */
120122
for (; src != end;) {
121123
c = *src++;
122124
t = &huff_decode_table[t->fstate & 0x1ff][c >> 4];

deps/nghttp2/lib/nghttp2_helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int nghttp2_adjust_local_window_size(int32_t *local_window_size_ptr,
160160
int32_t recv_reduction_delta;
161161
int32_t delta;
162162
int32_t new_recv_window_size =
163-
nghttp2_max(0, *recv_window_size_ptr) - *delta_ptr;
163+
nghttp2_max_int32(0, *recv_window_size_ptr) - *delta_ptr;
164164

165165
if (new_recv_window_size >= 0) {
166166
*recv_window_size_ptr = new_recv_window_size;
@@ -177,7 +177,7 @@ int nghttp2_adjust_local_window_size(int32_t *local_window_size_ptr,
177177
*local_window_size_ptr += delta;
178178
/* If there is recv_reduction due to earlier window_size
179179
reduction, we have to adjust it too. */
180-
recv_reduction_delta = nghttp2_min(*recv_reduction_ptr, delta);
180+
recv_reduction_delta = nghttp2_min_int32(*recv_reduction_ptr, delta);
181181
*recv_reduction_ptr -= recv_reduction_delta;
182182
if (*recv_window_size_ptr < 0) {
183183
*recv_window_size_ptr += recv_reduction_delta;
@@ -233,7 +233,7 @@ int nghttp2_increase_local_window_size(int32_t *local_window_size_ptr,
233233
*local_window_size_ptr += delta;
234234
/* If there is recv_reduction due to earlier window_size
235235
reduction, we have to adjust it too. */
236-
recv_reduction_delta = nghttp2_min(*recv_reduction_ptr, delta);
236+
recv_reduction_delta = nghttp2_min_int32(*recv_reduction_ptr, delta);
237237
*recv_reduction_ptr -= recv_reduction_delta;
238238

239239
*recv_window_size_ptr += recv_reduction_delta;

deps/nghttp2/lib/nghttp2_helper.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,31 @@
3535
#include <nghttp2/nghttp2.h>
3636
#include "nghttp2_mem.h"
3737

38-
#define nghttp2_min(A, B) ((A) < (B) ? (A) : (B))
39-
#define nghttp2_max(A, B) ((A) > (B) ? (A) : (B))
38+
#define nghttp2_max_def(SUFFIX, T) \
39+
static inline T nghttp2_max_##SUFFIX(T a, T b) { return a < b ? b : a; }
40+
41+
nghttp2_max_def(int8, int8_t);
42+
nghttp2_max_def(int16, int16_t);
43+
nghttp2_max_def(int32, int32_t);
44+
nghttp2_max_def(int64, int64_t);
45+
nghttp2_max_def(uint8, uint8_t);
46+
nghttp2_max_def(uint16, uint16_t);
47+
nghttp2_max_def(uint32, uint32_t);
48+
nghttp2_max_def(uint64, uint64_t);
49+
nghttp2_max_def(size, size_t);
50+
51+
#define nghttp2_min_def(SUFFIX, T) \
52+
static inline T nghttp2_min_##SUFFIX(T a, T b) { return a < b ? a : b; }
53+
54+
nghttp2_min_def(int8, int8_t);
55+
nghttp2_min_def(int16, int16_t);
56+
nghttp2_min_def(int32, int32_t);
57+
nghttp2_min_def(int64, int64_t);
58+
nghttp2_min_def(uint8, uint8_t);
59+
nghttp2_min_def(uint16, uint16_t);
60+
nghttp2_min_def(uint32, uint32_t);
61+
nghttp2_min_def(uint64, uint64_t);
62+
nghttp2_min_def(size, size_t);
4063

4164
#define lstreq(A, B, N) ((sizeof((A)) - 1) == (N) && memcmp((A), (B), (N)) == 0)
4265

deps/nghttp2/lib/nghttp2_pq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int nghttp2_pq_push(nghttp2_pq *pq, nghttp2_pq_entry *item) {
6969
void *nq;
7070
size_t ncapacity;
7171

72-
ncapacity = nghttp2_max(4, (pq->capacity * 2));
72+
ncapacity = nghttp2_max_size(4, (pq->capacity * 2));
7373

7474
nq = nghttp2_mem_realloc(pq->mem, pq->q,
7575
ncapacity * sizeof(nghttp2_pq_entry *));

deps/nghttp2/lib/nghttp2_ratelim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void nghttp2_ratelim_update(nghttp2_ratelim *rl, uint64_t tstamp) {
6161
}
6262

6363
rl->val += gain;
64-
rl->val = nghttp2_min(rl->val, rl->burst);
64+
rl->val = nghttp2_min_uint64(rl->val, rl->burst);
6565
}
6666

6767
int nghttp2_ratelim_drain(nghttp2_ratelim *rl, uint64_t n) {

deps/nghttp2/lib/nghttp2_session.c

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,10 +1700,11 @@ int nghttp2_session_adjust_idle_stream(nghttp2_session *session) {
17001700

17011701
/* Make minimum number of idle streams 16, and maximum 100, which
17021702
are arbitrary chosen numbers. */
1703-
max = nghttp2_min(
1704-
100, nghttp2_max(
1705-
16, nghttp2_min(session->local_settings.max_concurrent_streams,
1706-
session->pending_local_max_concurrent_stream)));
1703+
max = nghttp2_min_uint32(
1704+
100, nghttp2_max_uint32(
1705+
16, nghttp2_min_uint32(
1706+
session->local_settings.max_concurrent_streams,
1707+
session->pending_local_max_concurrent_stream)));
17071708

17081709
DEBUGF("stream: adjusting kept idle streams num_idle_streams=%zu, max=%zu\n",
17091710
session->num_idle_streams, max);
@@ -2131,10 +2132,11 @@ static nghttp2_ssize nghttp2_session_enforce_flow_control_limits(
21312132
session->remote_window_size, session->remote_settings.max_frame_size,
21322133
stream->stream_id, stream->remote_window_size);
21332134

2134-
return nghttp2_min(nghttp2_min(nghttp2_min(requested_window_size,
2135-
stream->remote_window_size),
2136-
session->remote_window_size),
2137-
(int32_t)session->remote_settings.max_frame_size);
2135+
return nghttp2_min_int32(
2136+
nghttp2_min_int32(nghttp2_min_int32((int32_t)requested_window_size,
2137+
stream->remote_window_size),
2138+
session->remote_window_size),
2139+
(int32_t)session->remote_settings.max_frame_size);
21382140
}
21392141

21402142
/*
@@ -2218,7 +2220,7 @@ static nghttp2_ssize session_call_select_padding(nghttp2_session *session,
22182220
}
22192221

22202222
max_paddedlen =
2221-
nghttp2_min(frame->hd.length + NGHTTP2_MAX_PADLEN, max_payloadlen);
2223+
nghttp2_min_size(frame->hd.length + NGHTTP2_MAX_PADLEN, max_payloadlen);
22222224

22232225
if (session->callbacks.select_padding_callback2) {
22242226
rv = session->callbacks.select_padding_callback2(
@@ -2248,8 +2250,8 @@ static int session_headers_add_pad(nghttp2_session *session,
22482250
aob = &session->aob;
22492251
framebufs = &aob->framebufs;
22502252

2251-
max_payloadlen = nghttp2_min(NGHTTP2_MAX_PAYLOADLEN,
2252-
frame->hd.length + NGHTTP2_MAX_PADLEN);
2253+
max_payloadlen = nghttp2_min_size(NGHTTP2_MAX_PAYLOADLEN,
2254+
frame->hd.length + NGHTTP2_MAX_PADLEN);
22532255

22542256
padded_payloadlen =
22552257
session_call_select_padding(session, frame, max_payloadlen);
@@ -2289,7 +2291,7 @@ static int session_pack_extension(nghttp2_session *session, nghttp2_bufs *bufs,
22892291
session->callbacks.pack_extension_callback);
22902292

22912293
buf = &bufs->head->buf;
2292-
buflen = nghttp2_min(nghttp2_buf_avail(buf), NGHTTP2_MAX_PAYLOADLEN);
2294+
buflen = nghttp2_min_size(nghttp2_buf_avail(buf), NGHTTP2_MAX_PAYLOADLEN);
22932295

22942296
if (session->callbacks.pack_extension_callback2) {
22952297
rv = session->callbacks.pack_extension_callback2(session, buf->last, buflen,
@@ -4708,7 +4710,8 @@ int nghttp2_session_update_local_settings(nghttp2_session *session,
47084710
case NGHTTP2_SETTINGS_HEADER_TABLE_SIZE:
47094711
header_table_size_seen = 1;
47104712
header_table_size = iv[i].value;
4711-
min_header_table_size = nghttp2_min(min_header_table_size, iv[i].value);
4713+
min_header_table_size =
4714+
nghttp2_min_uint32(min_header_table_size, iv[i].value);
47124715
break;
47134716
case NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE:
47144717
new_initial_window_size = (int32_t)iv[i].value;
@@ -5594,7 +5597,7 @@ static int session_update_consumed_size(nghttp2_session *session,
55945597
/* recv_window_size may be smaller than consumed_size, because it
55955598
may be decreased by negative value with
55965599
nghttp2_submit_window_update(). */
5597-
recv_size = nghttp2_min(*consumed_size_ptr, *recv_window_size_ptr);
5600+
recv_size = nghttp2_min_int32(*consumed_size_ptr, *recv_window_size_ptr);
55985601

55995602
if (nghttp2_should_send_window_update(local_window_size, recv_size)) {
56005603
rv = nghttp2_session_add_window_update(session, NGHTTP2_FLAG_NONE,
@@ -5717,7 +5720,7 @@ static int session_on_data_received_fail_fast(nghttp2_session *session) {
57175720
static size_t inbound_frame_payload_readlen(nghttp2_inbound_frame *iframe,
57185721
const uint8_t *in,
57195722
const uint8_t *last) {
5720-
return nghttp2_min((size_t)(last - in), iframe->payloadleft);
5723+
return nghttp2_min_size((size_t)(last - in), iframe->payloadleft);
57215724
}
57225725

57235726
/*
@@ -5732,8 +5735,8 @@ static size_t inbound_frame_buf_read(nghttp2_inbound_frame *iframe,
57325735
const uint8_t *in, const uint8_t *last) {
57335736
size_t readlen;
57345737

5735-
readlen =
5736-
nghttp2_min((size_t)(last - in), nghttp2_buf_mark_avail(&iframe->sbuf));
5738+
readlen = nghttp2_min_size((size_t)(last - in),
5739+
nghttp2_buf_mark_avail(&iframe->sbuf));
57375740

57385741
iframe->sbuf.last = nghttp2_cpymem(iframe->sbuf.last, in, readlen);
57395742

@@ -5900,7 +5903,7 @@ nghttp2_ssize nghttp2_session_mem_recv2(nghttp2_session *session,
59005903
for (;;) {
59015904
switch (iframe->state) {
59025905
case NGHTTP2_IB_READ_CLIENT_MAGIC:
5903-
readlen = nghttp2_min(inlen, iframe->payloadleft);
5906+
readlen = nghttp2_min_size(inlen, iframe->payloadleft);
59045907

59055908
if (memcmp(&NGHTTP2_CLIENT_MAGIC[NGHTTP2_CLIENT_MAGIC_LEN -
59065909
iframe->payloadleft],
@@ -7509,7 +7512,8 @@ int nghttp2_session_add_goaway(nghttp2_session *session, int32_t last_stream_id,
75097512

75107513
/* last_stream_id must not be increased from the value previously
75117514
sent */
7512-
last_stream_id = nghttp2_min(last_stream_id, session->local_last_stream_id);
7515+
last_stream_id =
7516+
nghttp2_min_int32(last_stream_id, session->local_last_stream_id);
75137517

75147518
nghttp2_frame_goaway_init(&frame->goaway, last_stream_id, error_code,
75157519
opaque_data_copy, opaque_data_len);
@@ -7823,7 +7827,8 @@ int nghttp2_session_pack_data(nghttp2_session *session, nghttp2_bufs *bufs,
78237827
frame->hd.length = (size_t)payloadlen;
78247828
frame->data.padlen = 0;
78257829

7826-
max_payloadlen = nghttp2_min(datamax, frame->hd.length + NGHTTP2_MAX_PADLEN);
7830+
max_payloadlen =
7831+
nghttp2_min_size(datamax, frame->hd.length + NGHTTP2_MAX_PADLEN);
78277832

78287833
padded_payloadlen =
78297834
session_call_select_padding(session, frame, max_payloadlen);
@@ -7997,7 +8002,7 @@ int32_t nghttp2_session_get_stream_remote_window_size(nghttp2_session *session,
79978002

79988003
/* stream->remote_window_size can be negative when
79998004
SETTINGS_INITIAL_WINDOW_SIZE is changed. */
8000-
return nghttp2_max(0, stream->remote_window_size);
8005+
return nghttp2_max_int32(0, stream->remote_window_size);
80018006
}
80028007

80038008
int32_t nghttp2_session_get_remote_window_size(nghttp2_session *session) {

deps/nghttp2/lib/nghttp2_stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ int32_t nghttp2_stream_dep_distributed_weight(nghttp2_stream *stream,
312312
int32_t weight) {
313313
weight = stream->weight * weight / stream->sum_dep_weight;
314314

315-
return nghttp2_max(1, weight);
315+
return nghttp2_max_int32(1, weight);
316316
}
317317

318318
#ifdef STREAM_DEP_DEBUG

deps/nghttp2/lib/nghttp2_submit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,10 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags,
411411
if (window_size_increment > 0) {
412412
if (stream_id == 0) {
413413
session->consumed_size =
414-
nghttp2_max(0, session->consumed_size - window_size_increment);
414+
nghttp2_max_int32(0, session->consumed_size - window_size_increment);
415415
} else {
416416
stream->consumed_size =
417-
nghttp2_max(0, stream->consumed_size - window_size_increment);
417+
nghttp2_max_int32(0, stream->consumed_size - window_size_increment);
418418
}
419419

420420
return nghttp2_session_add_window_update(session, 0, stream_id,

0 commit comments

Comments
 (0)