Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a9f3b9d

Browse filesBrowse files
nodejs-github-botrichardlau
authored andcommitted
deps: update nghttp2 to 1.61.0
PR-URL: #52395 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
1 parent 1b6fa70 commit a9f3b9d
Copy full SHA for a9f3b9d

10 files changed

+100-35Lines changed: 100 additions & 35 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎deps/nghttp2/lib/CMakeLists.txt‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/CMakeLists.txt
+17-13Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ set(NGHTTP2_RES "")
3434
set(STATIC_LIB "nghttp2_static")
3535
set(SHARED_LIB "nghttp2")
3636

37+
if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS AND MSVC AND NOT STATIC_LIB_SUFFIX)
38+
set(STATIC_LIB_SUFFIX "_static")
39+
endif()
40+
3741
if(WIN32)
3842
configure_file(
3943
version.rc.in
@@ -66,23 +70,23 @@ if(BUILD_SHARED_LIBS)
6670
endif()
6771

6872
# Static library (for unittests because of symbol visibility)
69-
add_library(${STATIC_LIB} STATIC ${NGHTTP2_SOURCES})
73+
if(BUILD_STATIC_LIBS)
74+
add_library(${STATIC_LIB} STATIC ${NGHTTP2_SOURCES})
7075

71-
set_target_properties(${STATIC_LIB} PROPERTIES
72-
COMPILE_FLAGS "${WARNCFLAGS}"
73-
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
74-
ARCHIVE_OUTPUT_NAME nghttp2${STATIC_LIB_SUFFIX}
75-
)
76+
set_target_properties(${STATIC_LIB} PROPERTIES
77+
COMPILE_FLAGS "${WARNCFLAGS}"
78+
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
79+
ARCHIVE_OUTPUT_NAME nghttp2${STATIC_LIB_SUFFIX}
80+
)
7681

77-
target_include_directories(${STATIC_LIB} INTERFACE
78-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/includes>
79-
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>
80-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
81-
)
82+
target_include_directories(${STATIC_LIB} INTERFACE
83+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/includes>
84+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/includes>
85+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
86+
)
8287

83-
target_compile_definitions(${STATIC_LIB} PUBLIC "-DNGHTTP2_STATICLIB")
88+
target_compile_definitions(${STATIC_LIB} PUBLIC "-DNGHTTP2_STATICLIB")
8489

85-
if(BUILD_STATIC_LIBS)
8690
install(TARGETS ${STATIC_LIB} EXPORT ${EXPORT_SET})
8791
list(APPEND nghttp2_exports ${STATIC_LIB})
8892
endif()
Collapse file

‎deps/nghttp2/lib/Makefile.in‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/Makefile.in
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ EXTRABPFCFLAGS = @EXTRABPFCFLAGS@
327327
EXTRACFLAG = @EXTRACFLAG@
328328
EXTRA_DEFS = @EXTRA_DEFS@
329329
FGREP = @FGREP@
330-
FILECMD = @FILECMD@
331330
GREP = @GREP@
332331
HAVE_CXX14 = @HAVE_CXX14@
333332
INSTALL = @INSTALL@
Collapse file

‎deps/nghttp2/lib/includes/Makefile.in‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/includes/Makefile.in
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ EXTRABPFCFLAGS = @EXTRABPFCFLAGS@
232232
EXTRACFLAG = @EXTRACFLAG@
233233
EXTRA_DEFS = @EXTRA_DEFS@
234234
FGREP = @FGREP@
235-
FILECMD = @FILECMD@
236235
GREP = @GREP@
237236
HAVE_CXX14 = @HAVE_CXX14@
238237
INSTALL = @INSTALL@
Collapse file

‎deps/nghttp2/lib/includes/nghttp2/nghttp2.h‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/includes/nghttp2/nghttp2.h
+17-1Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,12 @@ typedef enum {
466466
* exhaustion on server side to send these frames forever and does
467467
* not read network.
468468
*/
469-
NGHTTP2_ERR_FLOODED = -904
469+
NGHTTP2_ERR_FLOODED = -904,
470+
/**
471+
* When a local endpoint receives too many CONTINUATION frames
472+
* following a HEADER frame.
473+
*/
474+
NGHTTP2_ERR_TOO_MANY_CONTINUATIONS = -905,
470475
} nghttp2_error;
471476

472477
/**
@@ -3205,6 +3210,17 @@ NGHTTP2_EXTERN void
32053210
nghttp2_option_set_stream_reset_rate_limit(nghttp2_option *option,
32063211
uint64_t burst, uint64_t rate);
32073212

3213+
/**
3214+
* @function
3215+
*
3216+
* This function sets the maximum number of CONTINUATION frames
3217+
* following an incoming HEADER frame. If more than those frames are
3218+
* received, the remote endpoint is considered to be misbehaving and
3219+
* session will be closed. The default value is 8.
3220+
*/
3221+
NGHTTP2_EXTERN void nghttp2_option_set_max_continuations(nghttp2_option *option,
3222+
size_t val);
3223+
32083224
/**
32093225
* @function
32103226
*
Collapse file

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

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
+2-2Lines 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.60.0"
32+
#define NGHTTP2_VERSION "1.61.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 0x013c00
40+
#define NGHTTP2_VERSION_NUM 0x013d00
4141

4242
#endif /* NGHTTP2VER_H */
Collapse file

‎deps/nghttp2/lib/nghttp2_helper.c‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_helper.c
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ const char *nghttp2_strerror(int error_code) {
336336
"closed";
337337
case NGHTTP2_ERR_TOO_MANY_SETTINGS:
338338
return "SETTINGS frame contained more than the maximum allowed entries";
339+
case NGHTTP2_ERR_TOO_MANY_CONTINUATIONS:
340+
return "Too many CONTINUATION frames following a HEADER frame";
339341
default:
340342
return "Unknown error code";
341343
}
Collapse file

‎deps/nghttp2/lib/nghttp2_option.c‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_option.c
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,8 @@ void nghttp2_option_set_stream_reset_rate_limit(nghttp2_option *option,
150150
option->stream_reset_burst = burst;
151151
option->stream_reset_rate = rate;
152152
}
153+
154+
void nghttp2_option_set_max_continuations(nghttp2_option *option, size_t val) {
155+
option->opt_set_mask |= NGHTTP2_OPT_MAX_CONTINUATIONS;
156+
option->max_continuations = val;
157+
}
Collapse file

‎deps/nghttp2/lib/nghttp2_option.h‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_option.h
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ typedef enum {
7171
NGHTTP2_OPT_SERVER_FALLBACK_RFC7540_PRIORITIES = 1 << 13,
7272
NGHTTP2_OPT_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION = 1 << 14,
7373
NGHTTP2_OPT_STREAM_RESET_RATE_LIMIT = 1 << 15,
74+
NGHTTP2_OPT_MAX_CONTINUATIONS = 1 << 16,
7475
} nghttp2_option_flag;
7576

7677
/**
@@ -98,6 +99,10 @@ struct nghttp2_option {
9899
* NGHTTP2_OPT_MAX_SETTINGS
99100
*/
100101
size_t max_settings;
102+
/**
103+
* NGHTTP2_OPT_MAX_CONTINUATIONS
104+
*/
105+
size_t max_continuations;
101106
/**
102107
* Bitwise OR of nghttp2_option_flag to determine that which fields
103108
* are specified.
Collapse file

‎deps/nghttp2/lib/nghttp2_session.c‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_session.c
+42-17Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ static int session_new(nghttp2_session **session_ptr,
497497
(*session_ptr)->max_send_header_block_length = NGHTTP2_MAX_HEADERSLEN;
498498
(*session_ptr)->max_outbound_ack = NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM;
499499
(*session_ptr)->max_settings = NGHTTP2_DEFAULT_MAX_SETTINGS;
500+
(*session_ptr)->max_continuations = NGHTTP2_DEFAULT_MAX_CONTINUATIONS;
500501

501502
if (option) {
502503
if ((option->opt_set_mask & NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE) &&
@@ -585,6 +586,10 @@ static int session_new(nghttp2_session **session_ptr,
585586
option->stream_reset_burst,
586587
option->stream_reset_rate);
587588
}
589+
590+
if (option->opt_set_mask & NGHTTP2_OPT_MAX_CONTINUATIONS) {
591+
(*session_ptr)->max_continuations = option->max_continuations;
592+
}
588593
}
589594

590595
rv = nghttp2_hd_deflate_init2(&(*session_ptr)->hd_deflater,
@@ -979,7 +984,14 @@ static int session_attach_stream_item(nghttp2_session *session,
979984
return 0;
980985
}
981986

982-
return session_ob_data_push(session, stream);
987+
rv = session_ob_data_push(session, stream);
988+
if (rv != 0) {
989+
nghttp2_stream_detach_item(stream);
990+
991+
return rv;
992+
}
993+
994+
return 0;
983995
}
984996

985997
static void session_detach_stream_item(nghttp2_session *session,
@@ -1309,9 +1321,11 @@ nghttp2_stream *nghttp2_session_open_stream(nghttp2_session *session,
13091321
assert((stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES) ||
13101322
nghttp2_stream_in_dep_tree(stream));
13111323

1324+
nghttp2_session_detach_idle_stream(session, stream);
1325+
13121326
if (nghttp2_stream_in_dep_tree(stream)) {
13131327
assert(!(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES));
1314-
nghttp2_session_detach_idle_stream(session, stream);
1328+
13151329
rv = nghttp2_stream_dep_remove(stream);
13161330
if (rv != 0) {
13171331
return NULL;
@@ -1471,6 +1485,21 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id,
14711485

14721486
DEBUGF("stream: stream(%p)=%d close\n", stream, stream->stream_id);
14731487

1488+
/* We call on_stream_close_callback even if stream->state is
1489+
NGHTTP2_STREAM_INITIAL. This will happen while sending request
1490+
HEADERS, a local endpoint receives RST_STREAM for that stream. It
1491+
may be PROTOCOL_ERROR, but without notifying stream closure will
1492+
hang the stream in a local endpoint.
1493+
*/
1494+
1495+
if (session->callbacks.on_stream_close_callback) {
1496+
if (session->callbacks.on_stream_close_callback(
1497+
session, stream_id, error_code, session->user_data) != 0) {
1498+
1499+
return NGHTTP2_ERR_CALLBACK_FAILURE;
1500+
}
1501+
}
1502+
14741503
if (stream->item) {
14751504
nghttp2_outbound_item *item;
14761505

@@ -1488,21 +1517,6 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id,
14881517
}
14891518
}
14901519

1491-
/* We call on_stream_close_callback even if stream->state is
1492-
NGHTTP2_STREAM_INITIAL. This will happen while sending request
1493-
HEADERS, a local endpoint receives RST_STREAM for that stream. It
1494-
may be PROTOCOL_ERROR, but without notifying stream closure will
1495-
hang the stream in a local endpoint.
1496-
*/
1497-
1498-
if (session->callbacks.on_stream_close_callback) {
1499-
if (session->callbacks.on_stream_close_callback(
1500-
session, stream_id, error_code, session->user_data) != 0) {
1501-
1502-
return NGHTTP2_ERR_CALLBACK_FAILURE;
1503-
}
1504-
}
1505-
15061520
is_my_stream_id = nghttp2_session_is_my_stream_id(session, stream_id);
15071521

15081522
/* pushed streams which is not opened yet is not counted toward max
@@ -1559,6 +1573,11 @@ int nghttp2_session_destroy_stream(nghttp2_session *session,
15591573
}
15601574
}
15611575

1576+
if (stream->queued &&
1577+
(stream->flags & NGHTTP2_STREAM_FLAG_NO_RFC7540_PRIORITIES)) {
1578+
session_ob_data_remove(session, stream);
1579+
}
1580+
15621581
nghttp2_map_remove(&session->streams, stream->stream_id);
15631582
nghttp2_stream_free(stream);
15641583
nghttp2_mem_free(mem, stream);
@@ -6812,6 +6831,8 @@ nghttp2_ssize nghttp2_session_mem_recv2(nghttp2_session *session,
68126831
}
68136832
}
68146833
session_inbound_frame_reset(session);
6834+
6835+
session->num_continuations = 0;
68156836
}
68166837
break;
68176838
}
@@ -6933,6 +6954,10 @@ nghttp2_ssize nghttp2_session_mem_recv2(nghttp2_session *session,
69336954
}
69346955
#endif /* DEBUGBUILD */
69356956

6957+
if (++session->num_continuations > session->max_continuations) {
6958+
return NGHTTP2_ERR_TOO_MANY_CONTINUATIONS;
6959+
}
6960+
69366961
readlen = inbound_frame_buf_read(iframe, in, last);
69376962
in += readlen;
69386963

Collapse file

‎deps/nghttp2/lib/nghttp2_session.h‎

Copy file name to clipboardExpand all lines: deps/nghttp2/lib/nghttp2_session.h
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ typedef struct {
110110
#define NGHTTP2_DEFAULT_STREAM_RESET_BURST 1000
111111
#define NGHTTP2_DEFAULT_STREAM_RESET_RATE 33
112112

113+
/* The default max number of CONTINUATION frames following an incoming
114+
HEADER frame. */
115+
#define NGHTTP2_DEFAULT_MAX_CONTINUATIONS 8
116+
113117
/* Internal state when receiving incoming frame */
114118
typedef enum {
115119
/* Receiving frame header */
@@ -290,6 +294,12 @@ struct nghttp2_session {
290294
size_t max_send_header_block_length;
291295
/* The maximum number of settings accepted per SETTINGS frame. */
292296
size_t max_settings;
297+
/* The maximum number of CONTINUATION frames following an incoming
298+
HEADER frame. */
299+
size_t max_continuations;
300+
/* The number of CONTINUATION frames following an incoming HEADER
301+
frame. This variable is reset when END_HEADERS flag is seen. */
302+
size_t num_continuations;
293303
/* Next Stream ID. Made unsigned int to detect >= (1 << 31). */
294304
uint32_t next_stream_id;
295305
/* The last stream ID this session initiated. For client session,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.