Skip to content

Commit 0b8efea

Browse files
yashLadhasxa
authored andcommitted
deps: update nghttp2 to 1.47.0
Added script to update nghttp2 in future. One can use ```sh $ ./tools/update-nghttp2.sh 1.47.0 ``` It will automatically copy and update the nghttps in deps. Fixes: #42089 PR-URL: #42127 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent 2bc136d commit 0b8efea

16 files changed

+81
-18
lines changed

deps/nghttp2/lib/Makefile.in

+3
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ LIBMRUBY_LIBS = @LIBMRUBY_LIBS@
362362
LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@
363363
LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@
364364
LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@
365+
LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@
366+
LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@
365367
LIBNGTCP2_CRYPTO_OPENSSL_CFLAGS = @LIBNGTCP2_CRYPTO_OPENSSL_CFLAGS@
366368
LIBNGTCP2_CRYPTO_OPENSSL_LIBS = @LIBNGTCP2_CRYPTO_OPENSSL_LIBS@
367369
LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@
@@ -408,6 +410,7 @@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
408410
PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
409411
PYTHON_LIBS = @PYTHON_LIBS@
410412
PYTHON_PLATFORM = @PYTHON_PLATFORM@
413+
PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@
411414
PYTHON_PREFIX = @PYTHON_PREFIX@
412415
PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
413416
PYTHON_VERSION = @PYTHON_VERSION@

deps/nghttp2/lib/includes/Makefile.in

+3
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ LIBMRUBY_LIBS = @LIBMRUBY_LIBS@
271271
LIBNGHTTP3_CFLAGS = @LIBNGHTTP3_CFLAGS@
272272
LIBNGHTTP3_LIBS = @LIBNGHTTP3_LIBS@
273273
LIBNGTCP2_CFLAGS = @LIBNGTCP2_CFLAGS@
274+
LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS = @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@
275+
LIBNGTCP2_CRYPTO_BORINGSSL_LIBS = @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@
274276
LIBNGTCP2_CRYPTO_OPENSSL_CFLAGS = @LIBNGTCP2_CRYPTO_OPENSSL_CFLAGS@
275277
LIBNGTCP2_CRYPTO_OPENSSL_LIBS = @LIBNGTCP2_CRYPTO_OPENSSL_LIBS@
276278
LIBNGTCP2_LIBS = @LIBNGTCP2_LIBS@
@@ -317,6 +319,7 @@ PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
317319
PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
318320
PYTHON_LIBS = @PYTHON_LIBS@
319321
PYTHON_PLATFORM = @PYTHON_PLATFORM@
322+
PYTHON_PLATFORM_SITE_PKG = @PYTHON_PLATFORM_SITE_PKG@
320323
PYTHON_PREFIX = @PYTHON_PREFIX@
321324
PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
322325
PYTHON_VERSION = @PYTHON_VERSION@

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

+2-2
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.45.1"
32+
#define NGHTTP2_VERSION "1.47.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 0x012d01
40+
#define NGHTTP2_VERSION_NUM 0x012f00
4141

4242
#endif /* NGHTTP2VER_H */

deps/nghttp2/lib/nghttp2_buf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void nghttp2_buf_free(nghttp2_buf *buf, nghttp2_mem *mem);
9999
* |new_cap|. If extensions took place, buffer pointers in |buf| will
100100
* change.
101101
*
102-
* This function returns 0 if it succeeds, or one of the followings
102+
* This function returns 0 if it succeeds, or one of the following
103103
* negative error codes:
104104
*
105105
* NGHTTP2_ERR_NOMEM

deps/nghttp2/lib/nghttp2_frame.c

-2
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,6 @@ int nghttp2_frame_unpack_goaway_payload2(nghttp2_goaway *frame,
654654
var_gift_payloadlen = 0;
655655
}
656656

657-
payloadlen -= var_gift_payloadlen;
658-
659657
if (!var_gift_payloadlen) {
660658
var_gift_payload = NULL;
661659
} else {

deps/nghttp2/lib/nghttp2_frame.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#define NGHTTP2_MAX_FRAME_SIZE_MIN (1 << 14)
4747

4848
#define NGHTTP2_MAX_PAYLOADLEN 16384
49-
/* The one frame buffer length for tranmission. We may use several of
49+
/* The one frame buffer length for transmission. We may use several of
5050
them to support CONTINUATION. To account for Pad Length field, we
5151
allocate extra 1 byte, which saves extra large memcopying. */
5252
#define NGHTTP2_FRAMEBUF_CHUNKLEN \

deps/nghttp2/lib/nghttp2_hd.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,8 @@ int nghttp2_hd_inflate_change_table_size(
12631263
return NGHTTP2_ERR_INVALID_STATE;
12641264
}
12651265

1266+
inflater->settings_hd_table_bufsize_max = settings_max_dynamic_table_size;
1267+
12661268
/* It seems that encoder is not required to send dynamic table size
12671269
update if the table size is not changed after applying
12681270
SETTINGS_HEADER_TABLE_SIZE. RFC 7541 is ambiguous here, but this
@@ -1275,13 +1277,12 @@ int nghttp2_hd_inflate_change_table_size(
12751277
/* Remember minimum value, and validate that encoder sends the
12761278
value less than or equal to this. */
12771279
inflater->min_hd_table_bufsize_max = settings_max_dynamic_table_size;
1278-
}
12791280

1280-
inflater->settings_hd_table_bufsize_max = settings_max_dynamic_table_size;
1281+
inflater->ctx.hd_table_bufsize_max = settings_max_dynamic_table_size;
12811282

1282-
inflater->ctx.hd_table_bufsize_max = settings_max_dynamic_table_size;
1283+
hd_context_shrink_table_size(&inflater->ctx, NULL);
1284+
}
12831285

1284-
hd_context_shrink_table_size(&inflater->ctx, NULL);
12851286
return 0;
12861287
}
12871288

deps/nghttp2/lib/nghttp2_map.c

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ static int map_resize(nghttp2_map *map, uint32_t new_tablelen,
189189
nghttp2_map_bucket *new_table;
190190
nghttp2_map_bucket *bkt;
191191
int rv;
192+
(void)rv;
192193

193194
new_table =
194195
nghttp2_mem_calloc(map->mem, new_tablelen, sizeof(nghttp2_map_bucket));

deps/nghttp2/lib/nghttp2_net.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#if defined(WIN32)
4343
/* Windows requires ws2_32 library for ntonl family functions. We
4444
define inline functions for those function so that we don't have
45-
dependeny on that lib. */
45+
dependency on that lib. */
4646

4747
# ifdef _MSC_VER
4848
# define STIN static __inline

deps/nghttp2/lib/nghttp2_outbound_item.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ struct nghttp2_outbound_item {
111111
to this structure to avoid frequent memory allocation. */
112112
nghttp2_ext_frame_payload ext_frame_payload;
113113
nghttp2_aux_data aux_data;
114-
/* The priority used in priority comparion. Smaller is served
114+
/* The priority used in priority comparison. Smaller is served
115115
earlier. For PING, SETTINGS and non-DATA frames (excluding
116116
response HEADERS frame) have dedicated cycle value defined above.
117117
For DATA frame, cycle is computed by taking into account of

deps/nghttp2/lib/nghttp2_pq.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ typedef int (*nghttp2_pq_item_cb)(nghttp2_pq_entry *item, void *arg);
114114
void nghttp2_pq_update(nghttp2_pq *pq, nghttp2_pq_item_cb fun, void *arg);
115115

116116
/*
117-
* Applys |fun| to each item in |pq|. The |arg| is passed as arg
117+
* Applies |fun| to each item in |pq|. The |arg| is passed as arg
118118
* parameter to callback function. This function must not change the
119119
* ordering key. If the return value from callback is nonzero, this
120120
* function returns 1 immediately without iterating remaining items.

deps/nghttp2/lib/nghttp2_session.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5341,7 +5341,7 @@ static ssize_t inbound_frame_compute_pad(nghttp2_inbound_frame *iframe) {
53415341

53425342
/*
53435343
* This function returns the effective payload length in the data of
5344-
* length |readlen| when the remaning payload is |payloadleft|. The
5344+
* length |readlen| when the remaining payload is |payloadleft|. The
53455345
* |payloadleft| does not include |readlen|. If padding was started
53465346
* strictly before this data chunk, this function returns -1.
53475347
*/

deps/nghttp2/lib/nghttp2_session.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ int nghttp2_session_add_rst_stream(nghttp2_session *session, int32_t stream_id,
408408
uint32_t error_code);
409409

410410
/*
411-
* Adds PING frame. This is a convenient functin built on top of
411+
* Adds PING frame. This is a convenient function built on top of
412412
* nghttp2_session_add_frame() to add PING easily.
413413
*
414414
* If the |opaque_data| is not NULL, it must point to 8 bytes memory

deps/nghttp2/lib/nghttp2_stream.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "nghttp2_frame.h"
3434

3535
/* Maximum distance between any two stream's cycle in the same
36-
prirority queue. Imagine stream A's cycle is A, and stream B's
36+
priority queue. Imagine stream A's cycle is A, and stream B's
3737
cycle is B, and A < B. The cycle is unsigned 32 bit integer, it
3838
may get overflow. Because of how we calculate the next cycle
3939
value, if B - A is less than or equals to

deps/nghttp2/lib/nghttp2_submit.c

-2
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,6 @@ int nghttp2_session_set_local_window_size(nghttp2_session *session,
492492
return nghttp2_session_update_recv_stream_window_size(session, stream, 0,
493493
1);
494494
}
495-
496-
return 0;
497495
}
498496

499497
int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags,

tools/update-nghttp2.sh

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/sh
2+
set -e
3+
# Shell script to update nghttp2 in the source treee to specific version
4+
5+
BASE_DIR="$( pwd )"/
6+
DEPS_DIR="$BASE_DIR"deps/
7+
NGHTTP2_VERSION=$1
8+
9+
if [ "$#" -le 0 ]; then
10+
echo "Error: please provide an nghttp2 version to update to"
11+
exit 1
12+
fi
13+
14+
echo "Making temporary workspace"
15+
16+
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
17+
18+
cleanup () {
19+
EXIT_CODE=$?
20+
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
21+
exit $EXIT_CODE
22+
}
23+
24+
trap cleanup INT TERM EXIT
25+
26+
NGHTTP2_REF="v$NGHTTP2_VERSION"
27+
NGHTTP2_TARBALL="nghttp2-$NGHTTP2_VERSION.tar.gz"
28+
29+
cd "$WORKSPACE"
30+
31+
echo "Fetching nghttp2 source archive"
32+
curl -sL -o "$NGHTTP2_TARBALL" "https://github.com/nghttp2/nghttp2/releases/download/$NGHTTP2_REF/$NGHTTP2_TARBALL"
33+
gzip -dc "$NGHTTP2_TARBALL" | tar xf -
34+
rm "$NGHTTP2_TARBALL"
35+
mv "nghttp2-$NGHTTP2_VERSION" nghttp2
36+
37+
echo "Removing everything, except lib/ and COPYING"
38+
cd nghttp2
39+
for dir in *; do
40+
if [ "$dir" = "lib" ] || [ "$dir" = "COPYING" ]; then
41+
continue
42+
fi
43+
rm -rf "$dir"
44+
done
45+
46+
echo "Copying existing gyp files"
47+
cp "$DEPS_DIR/nghttp2/nghttp2.gyp" "$WORKSPACE/nghttp2"
48+
49+
echo "Replacing existing nghttp2"
50+
rm -rf "$DEPS_DIR/nghttp2"
51+
mv "$WORKSPACE/nghttp2" "$DEPS_DIR/"
52+
53+
echo "All done!"
54+
echo ""
55+
echo "Please git add nghttp2, commit the new version:"
56+
echo ""
57+
echo "$ git add -A deps/nghttp2"
58+
echo "$ git commit -m \"deps: update nghttp2 to $NGHTTP2_VERSION\""
59+
echo ""

0 commit comments

Comments
 (0)