deps: update nghttp2 to 1.29.0
PR-URL: https://github.com/nodejs/node/pull/17908 Refs: https://github.com/nodejs/node/issues/17746 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
27470e4ec7
commit
cfca536d8f
4
deps/nghttp2/lib/CMakeLists.txt
vendored
4
deps/nghttp2/lib/CMakeLists.txt
vendored
@ -44,6 +44,10 @@ set_target_properties(nghttp2 PROPERTIES
|
|||||||
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
|
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
|
||||||
C_VISIBILITY_PRESET hidden
|
C_VISIBILITY_PRESET hidden
|
||||||
)
|
)
|
||||||
|
target_include_directories(nghttp2 INTERFACE
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/includes"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/includes"
|
||||||
|
)
|
||||||
|
|
||||||
if(HAVE_CUNIT)
|
if(HAVE_CUNIT)
|
||||||
# Static library (for unittests because of symbol visibility)
|
# Static library (for unittests because of symbol visibility)
|
||||||
|
63
deps/nghttp2/lib/includes/nghttp2/nghttp2.h
vendored
63
deps/nghttp2/lib/includes/nghttp2/nghttp2.h
vendored
@ -387,6 +387,11 @@ typedef enum {
|
|||||||
* Indicates that a processing was canceled.
|
* Indicates that a processing was canceled.
|
||||||
*/
|
*/
|
||||||
NGHTTP2_ERR_CANCEL = -535,
|
NGHTTP2_ERR_CANCEL = -535,
|
||||||
|
/**
|
||||||
|
* When a local endpoint expects to receive SETTINGS frame, it
|
||||||
|
* receives an other type of frame.
|
||||||
|
*/
|
||||||
|
NGHTTP2_ERR_SETTINGS_EXPECTED = -536,
|
||||||
/**
|
/**
|
||||||
* The errors < :enum:`NGHTTP2_ERR_FATAL` mean that the library is
|
* The errors < :enum:`NGHTTP2_ERR_FATAL` mean that the library is
|
||||||
* under unexpected condition and processing was terminated (e.g.,
|
* under unexpected condition and processing was terminated (e.g.,
|
||||||
@ -1987,6 +1992,9 @@ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session,
|
|||||||
* of length |len|. |len| does not include the sentinel NULL
|
* of length |len|. |len| does not include the sentinel NULL
|
||||||
* character.
|
* character.
|
||||||
*
|
*
|
||||||
|
* This function is deprecated. The new application should use
|
||||||
|
* :type:`nghttp2_error_callback2`.
|
||||||
|
*
|
||||||
* The format of error message may change between nghttp2 library
|
* The format of error message may change between nghttp2 library
|
||||||
* versions. The application should not depend on the particular
|
* versions. The application should not depend on the particular
|
||||||
* format.
|
* format.
|
||||||
@ -2003,6 +2011,33 @@ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session,
|
|||||||
typedef int (*nghttp2_error_callback)(nghttp2_session *session, const char *msg,
|
typedef int (*nghttp2_error_callback)(nghttp2_session *session, const char *msg,
|
||||||
size_t len, void *user_data);
|
size_t len, void *user_data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @functypedef
|
||||||
|
*
|
||||||
|
* Callback function invoked when library provides the error code, and
|
||||||
|
* message. This callback is solely for debugging purpose.
|
||||||
|
* |lib_error_code| is one of error code defined in
|
||||||
|
* :enum:`nghttp2_error`. The |msg| is typically NULL-terminated
|
||||||
|
* string of length |len|, and intended for human consumption. |len|
|
||||||
|
* does not include the sentinel NULL character.
|
||||||
|
*
|
||||||
|
* The format of error message may change between nghttp2 library
|
||||||
|
* versions. The application should not depend on the particular
|
||||||
|
* format.
|
||||||
|
*
|
||||||
|
* Normally, application should return 0 from this callback. If fatal
|
||||||
|
* error occurred while doing something in this callback, application
|
||||||
|
* should return :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. In this case,
|
||||||
|
* library will return immediately with return value
|
||||||
|
* :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. Currently, if nonzero value
|
||||||
|
* is returned from this callback, they are treated as
|
||||||
|
* :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`, but application should not
|
||||||
|
* rely on this details.
|
||||||
|
*/
|
||||||
|
typedef int (*nghttp2_error_callback2)(nghttp2_session *session,
|
||||||
|
int lib_error_code, const char *msg,
|
||||||
|
size_t len, void *user_data);
|
||||||
|
|
||||||
struct nghttp2_session_callbacks;
|
struct nghttp2_session_callbacks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2267,10 +2302,30 @@ nghttp2_session_callbacks_set_on_extension_chunk_recv_callback(
|
|||||||
*
|
*
|
||||||
* Sets callback function invoked when library tells error message to
|
* Sets callback function invoked when library tells error message to
|
||||||
* the application.
|
* the application.
|
||||||
|
*
|
||||||
|
* This function is deprecated. The new application should use
|
||||||
|
* `nghttp2_session_callbacks_set_error_callback2()`.
|
||||||
|
*
|
||||||
|
* If both :type:`nghttp2_error_callback` and
|
||||||
|
* :type:`nghttp2_error_callback2` are set, the latter takes
|
||||||
|
* precedence.
|
||||||
*/
|
*/
|
||||||
NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback(
|
NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback(
|
||||||
nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback);
|
nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function
|
||||||
|
*
|
||||||
|
* Sets callback function invoked when library tells error code, and
|
||||||
|
* message to the application.
|
||||||
|
*
|
||||||
|
* If both :type:`nghttp2_error_callback` and
|
||||||
|
* :type:`nghttp2_error_callback2` are set, the latter takes
|
||||||
|
* precedence.
|
||||||
|
*/
|
||||||
|
NGHTTP2_EXTERN void nghttp2_session_callbacks_set_error_callback2(
|
||||||
|
nghttp2_session_callbacks *cbs, nghttp2_error_callback2 error_callback2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @functypedef
|
* @functypedef
|
||||||
*
|
*
|
||||||
@ -4702,8 +4757,8 @@ nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater,
|
|||||||
*
|
*
|
||||||
* After this function returns, it is safe to delete the |nva|.
|
* After this function returns, it is safe to delete the |nva|.
|
||||||
*
|
*
|
||||||
* This function returns 0 if it succeeds, or one of the following
|
* This function returns the number of bytes written to |buf| if it
|
||||||
* negative error codes:
|
* succeeds, or one of the following negative error codes:
|
||||||
*
|
*
|
||||||
* :enum:`NGHTTP2_ERR_NOMEM`
|
* :enum:`NGHTTP2_ERR_NOMEM`
|
||||||
* Out of memory.
|
* Out of memory.
|
||||||
@ -4734,8 +4789,8 @@ NGHTTP2_EXTERN ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater,
|
|||||||
*
|
*
|
||||||
* After this function returns, it is safe to delete the |nva|.
|
* After this function returns, it is safe to delete the |nva|.
|
||||||
*
|
*
|
||||||
* This function returns 0 if it succeeds, or one of the following
|
* This function returns the number of bytes written to |vec| if it
|
||||||
* negative error codes:
|
* succeeds, or one of the following negative error codes:
|
||||||
*
|
*
|
||||||
* :enum:`NGHTTP2_ERR_NOMEM`
|
* :enum:`NGHTTP2_ERR_NOMEM`
|
||||||
* Out of memory.
|
* Out of memory.
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* @macro
|
* @macro
|
||||||
* Version number of the nghttp2 library release
|
* Version number of the nghttp2 library release
|
||||||
*/
|
*/
|
||||||
#define NGHTTP2_VERSION "1.25.0"
|
#define NGHTTP2_VERSION "1.29.0"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @macro
|
* @macro
|
||||||
@ -37,6 +37,6 @@
|
|||||||
* release. This is a 24 bit number with 8 bits for major number, 8 bits
|
* release. This is a 24 bit number with 8 bits for major number, 8 bits
|
||||||
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
|
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
|
||||||
*/
|
*/
|
||||||
#define NGHTTP2_VERSION_NUM 0x011900
|
#define NGHTTP2_VERSION_NUM 0x011d00
|
||||||
|
|
||||||
#endif /* NGHTTP2VER_H */
|
#endif /* NGHTTP2VER_H */
|
||||||
|
2
deps/nghttp2/lib/nghttp2_buf.h
vendored
2
deps/nghttp2/lib/nghttp2_buf.h
vendored
@ -398,7 +398,7 @@ int nghttp2_bufs_advance(nghttp2_bufs *bufs);
|
|||||||
void nghttp2_bufs_seek_last_present(nghttp2_bufs *bufs);
|
void nghttp2_bufs_seek_last_present(nghttp2_bufs *bufs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns nonzero if bufs->cur->next is not emtpy.
|
* Returns nonzero if bufs->cur->next is not empty.
|
||||||
*/
|
*/
|
||||||
int nghttp2_bufs_next_present(nghttp2_bufs *bufs);
|
int nghttp2_bufs_next_present(nghttp2_bufs *bufs);
|
||||||
|
|
||||||
|
5
deps/nghttp2/lib/nghttp2_callbacks.c
vendored
5
deps/nghttp2/lib/nghttp2_callbacks.c
vendored
@ -168,3 +168,8 @@ void nghttp2_session_callbacks_set_error_callback(
|
|||||||
nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback) {
|
nghttp2_session_callbacks *cbs, nghttp2_error_callback error_callback) {
|
||||||
cbs->error_callback = error_callback;
|
cbs->error_callback = error_callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nghttp2_session_callbacks_set_error_callback2(
|
||||||
|
nghttp2_session_callbacks *cbs, nghttp2_error_callback2 error_callback2) {
|
||||||
|
cbs->error_callback2 = error_callback2;
|
||||||
|
}
|
||||||
|
1
deps/nghttp2/lib/nghttp2_callbacks.h
vendored
1
deps/nghttp2/lib/nghttp2_callbacks.h
vendored
@ -119,6 +119,7 @@ struct nghttp2_session_callbacks {
|
|||||||
nghttp2_unpack_extension_callback unpack_extension_callback;
|
nghttp2_unpack_extension_callback unpack_extension_callback;
|
||||||
nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback;
|
nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback;
|
||||||
nghttp2_error_callback error_callback;
|
nghttp2_error_callback error_callback;
|
||||||
|
nghttp2_error_callback2 error_callback2;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* NGHTTP2_CALLBACKS_H */
|
#endif /* NGHTTP2_CALLBACKS_H */
|
||||||
|
4
deps/nghttp2/lib/nghttp2_frame.h
vendored
4
deps/nghttp2/lib/nghttp2_frame.h
vendored
@ -70,7 +70,9 @@
|
|||||||
#define NGHTTP2_MAX_PADLEN 256
|
#define NGHTTP2_MAX_PADLEN 256
|
||||||
|
|
||||||
/* Union of extension frame payload */
|
/* Union of extension frame payload */
|
||||||
typedef union { nghttp2_ext_altsvc altsvc; } nghttp2_ext_frame_payload;
|
typedef union {
|
||||||
|
nghttp2_ext_altsvc altsvc;
|
||||||
|
} nghttp2_ext_frame_payload;
|
||||||
|
|
||||||
void nghttp2_frame_pack_frame_hd(uint8_t *buf, const nghttp2_frame_hd *hd);
|
void nghttp2_frame_pack_frame_hd(uint8_t *buf, const nghttp2_frame_hd *hd);
|
||||||
|
|
||||||
|
6
deps/nghttp2/lib/nghttp2_hd.h
vendored
6
deps/nghttp2/lib/nghttp2_hd.h
vendored
@ -211,7 +211,9 @@ typedef struct {
|
|||||||
|
|
||||||
#define HD_MAP_SIZE 128
|
#define HD_MAP_SIZE 128
|
||||||
|
|
||||||
typedef struct { nghttp2_hd_entry *table[HD_MAP_SIZE]; } nghttp2_hd_map;
|
typedef struct {
|
||||||
|
nghttp2_hd_entry *table[HD_MAP_SIZE];
|
||||||
|
} nghttp2_hd_map;
|
||||||
|
|
||||||
struct nghttp2_hd_deflater {
|
struct nghttp2_hd_deflater {
|
||||||
nghttp2_hd_context ctx;
|
nghttp2_hd_context ctx;
|
||||||
@ -313,7 +315,7 @@ void nghttp2_hd_deflate_free(nghttp2_hd_deflater *deflater);
|
|||||||
*
|
*
|
||||||
* This function expands |bufs| as necessary to store the result. If
|
* This function expands |bufs| as necessary to store the result. If
|
||||||
* buffers is full and the process still requires more space, this
|
* buffers is full and the process still requires more space, this
|
||||||
* funtion fails and returns NGHTTP2_ERR_HEADER_COMP.
|
* function fails and returns NGHTTP2_ERR_HEADER_COMP.
|
||||||
*
|
*
|
||||||
* After this function returns, it is safe to delete the |nva|.
|
* After this function returns, it is safe to delete the |nva|.
|
||||||
*
|
*
|
||||||
|
3
deps/nghttp2/lib/nghttp2_helper.c
vendored
3
deps/nghttp2/lib/nghttp2_helper.c
vendored
@ -322,6 +322,9 @@ const char *nghttp2_strerror(int error_code) {
|
|||||||
return "Internal error";
|
return "Internal error";
|
||||||
case NGHTTP2_ERR_CANCEL:
|
case NGHTTP2_ERR_CANCEL:
|
||||||
return "Cancel";
|
return "Cancel";
|
||||||
|
case NGHTTP2_ERR_SETTINGS_EXPECTED:
|
||||||
|
return "When a local endpoint expects to receive SETTINGS frame, it "
|
||||||
|
"receives an other type of frame";
|
||||||
case NGHTTP2_ERR_NOMEM:
|
case NGHTTP2_ERR_NOMEM:
|
||||||
return "Out of memory";
|
return "Out of memory";
|
||||||
case NGHTTP2_ERR_CALLBACK_FAILURE:
|
case NGHTTP2_ERR_CALLBACK_FAILURE:
|
||||||
|
2
deps/nghttp2/lib/nghttp2_outbound_item.h
vendored
2
deps/nghttp2/lib/nghttp2_outbound_item.h
vendored
@ -112,7 +112,7 @@ struct nghttp2_outbound_item {
|
|||||||
nghttp2_ext_frame_payload ext_frame_payload;
|
nghttp2_ext_frame_payload ext_frame_payload;
|
||||||
nghttp2_aux_data aux_data;
|
nghttp2_aux_data aux_data;
|
||||||
/* The priority used in priority comparion. Smaller is served
|
/* The priority used in priority comparion. Smaller is served
|
||||||
ealier. For PING, SETTINGS and non-DATA frames (excluding
|
earlier. For PING, SETTINGS and non-DATA frames (excluding
|
||||||
response HEADERS frame) have dedicated cycle value defined above.
|
response HEADERS frame) have dedicated cycle value defined above.
|
||||||
For DATA frame, cycle is computed by taking into account of
|
For DATA frame, cycle is computed by taking into account of
|
||||||
effective weight and frame payload length previously sent, so
|
effective weight and frame payload length previously sent, so
|
||||||
|
6
deps/nghttp2/lib/nghttp2_pq.h
vendored
6
deps/nghttp2/lib/nghttp2_pq.h
vendored
@ -35,7 +35,9 @@
|
|||||||
|
|
||||||
/* Implementation of priority queue */
|
/* Implementation of priority queue */
|
||||||
|
|
||||||
typedef struct { size_t index; } nghttp2_pq_entry;
|
typedef struct {
|
||||||
|
size_t index;
|
||||||
|
} nghttp2_pq_entry;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* The pointer to the pointer to the item stored */
|
/* The pointer to the pointer to the item stored */
|
||||||
@ -71,7 +73,7 @@ void nghttp2_pq_free(nghttp2_pq *pq);
|
|||||||
/*
|
/*
|
||||||
* Adds |item| to the priority queue |pq|.
|
* Adds |item| to the priority queue |pq|.
|
||||||
*
|
*
|
||||||
* This function returns 0 if it succeds, or one of the following
|
* This function returns 0 if it succeeds, or one of the following
|
||||||
* negative error codes:
|
* negative error codes:
|
||||||
*
|
*
|
||||||
* NGHTTP2_ERR_NOMEM
|
* NGHTTP2_ERR_NOMEM
|
||||||
|
4
deps/nghttp2/lib/nghttp2_queue.h
vendored
4
deps/nghttp2/lib/nghttp2_queue.h
vendored
@ -36,7 +36,9 @@ typedef struct nghttp2_queue_cell {
|
|||||||
struct nghttp2_queue_cell *next;
|
struct nghttp2_queue_cell *next;
|
||||||
} nghttp2_queue_cell;
|
} nghttp2_queue_cell;
|
||||||
|
|
||||||
typedef struct { nghttp2_queue_cell *front, *back; } nghttp2_queue;
|
typedef struct {
|
||||||
|
nghttp2_queue_cell *front, *back;
|
||||||
|
} nghttp2_queue;
|
||||||
|
|
||||||
void nghttp2_queue_init(nghttp2_queue *queue);
|
void nghttp2_queue_init(nghttp2_queue *queue);
|
||||||
void nghttp2_queue_free(nghttp2_queue *queue);
|
void nghttp2_queue_free(nghttp2_queue *queue);
|
||||||
|
51
deps/nghttp2/lib/nghttp2_session.c
vendored
51
deps/nghttp2/lib/nghttp2_session.c
vendored
@ -148,14 +148,16 @@ static int check_ext_type_set(const uint8_t *ext_types, uint8_t type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int session_call_error_callback(nghttp2_session *session,
|
static int session_call_error_callback(nghttp2_session *session,
|
||||||
const char *fmt, ...) {
|
int lib_error_code, const char *fmt,
|
||||||
|
...) {
|
||||||
size_t bufsize;
|
size_t bufsize;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *buf;
|
char *buf;
|
||||||
int rv;
|
int rv;
|
||||||
nghttp2_mem *mem;
|
nghttp2_mem *mem;
|
||||||
|
|
||||||
if (!session->callbacks.error_callback) {
|
if (!session->callbacks.error_callback &&
|
||||||
|
!session->callbacks.error_callback2) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,8 +191,13 @@ static int session_call_error_callback(nghttp2_session *session,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = session->callbacks.error_callback(session, buf, (size_t)rv,
|
if (session->callbacks.error_callback2) {
|
||||||
session->user_data);
|
rv = session->callbacks.error_callback2(session, lib_error_code, buf,
|
||||||
|
(size_t)rv, session->user_data);
|
||||||
|
} else {
|
||||||
|
rv = session->callbacks.error_callback(session, buf, (size_t)rv,
|
||||||
|
session->user_data);
|
||||||
|
}
|
||||||
|
|
||||||
nghttp2_mem_free(mem, buf);
|
nghttp2_mem_free(mem, buf);
|
||||||
|
|
||||||
@ -541,9 +548,8 @@ static int session_new(nghttp2_session **session_ptr,
|
|||||||
if (nghttp2_enable_strict_preface) {
|
if (nghttp2_enable_strict_preface) {
|
||||||
nghttp2_inbound_frame *iframe = &(*session_ptr)->iframe;
|
nghttp2_inbound_frame *iframe = &(*session_ptr)->iframe;
|
||||||
|
|
||||||
if (server &&
|
if (server && ((*session_ptr)->opt_flags &
|
||||||
((*session_ptr)->opt_flags & NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC) ==
|
NGHTTP2_OPTMASK_NO_RECV_CLIENT_MAGIC) == 0) {
|
||||||
0) {
|
|
||||||
iframe->state = NGHTTP2_IB_READ_CLIENT_MAGIC;
|
iframe->state = NGHTTP2_IB_READ_CLIENT_MAGIC;
|
||||||
iframe->payloadleft = NGHTTP2_CLIENT_MAGIC_LEN;
|
iframe->payloadleft = NGHTTP2_CLIENT_MAGIC_LEN;
|
||||||
} else {
|
} else {
|
||||||
@ -2183,7 +2189,7 @@ static int session_prep_frame(nghttp2_session *session,
|
|||||||
closed. */
|
closed. */
|
||||||
stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
|
stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
|
||||||
|
|
||||||
/* predicte should fail if stream is NULL. */
|
/* predicate should fail if stream is NULL. */
|
||||||
rv = session_predicate_push_promise_send(session, stream);
|
rv = session_predicate_push_promise_send(session, stream);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -2411,19 +2417,16 @@ static int session_close_stream_on_goaway(nghttp2_session *session,
|
|||||||
nghttp2_stream *stream, *next_stream;
|
nghttp2_stream *stream, *next_stream;
|
||||||
nghttp2_close_stream_on_goaway_arg arg = {session, NULL, last_stream_id,
|
nghttp2_close_stream_on_goaway_arg arg = {session, NULL, last_stream_id,
|
||||||
incoming};
|
incoming};
|
||||||
uint32_t error_code;
|
|
||||||
|
|
||||||
rv = nghttp2_map_each(&session->streams, find_stream_on_goaway_func, &arg);
|
rv = nghttp2_map_each(&session->streams, find_stream_on_goaway_func, &arg);
|
||||||
assert(rv == 0);
|
assert(rv == 0);
|
||||||
|
|
||||||
error_code =
|
|
||||||
session->server && incoming ? NGHTTP2_REFUSED_STREAM : NGHTTP2_CANCEL;
|
|
||||||
|
|
||||||
stream = arg.head;
|
stream = arg.head;
|
||||||
while (stream) {
|
while (stream) {
|
||||||
next_stream = stream->closed_next;
|
next_stream = stream->closed_next;
|
||||||
stream->closed_next = NULL;
|
stream->closed_next = NULL;
|
||||||
rv = nghttp2_session_close_stream(session, stream->stream_id, error_code);
|
rv = nghttp2_session_close_stream(session, stream->stream_id,
|
||||||
|
NGHTTP2_REFUSED_STREAM);
|
||||||
|
|
||||||
/* stream may be deleted here */
|
/* stream may be deleted here */
|
||||||
|
|
||||||
@ -3608,7 +3611,7 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame,
|
|||||||
nv.name->base, (int)nv.value->len, nv.value->base);
|
nv.name->base, (int)nv.value->len, nv.value->base);
|
||||||
|
|
||||||
rv2 = session_call_error_callback(
|
rv2 = session_call_error_callback(
|
||||||
session,
|
session, NGHTTP2_ERR_HTTP_HEADER,
|
||||||
"Ignoring received invalid HTTP header field: frame type: "
|
"Ignoring received invalid HTTP header field: frame type: "
|
||||||
"%u, stream: %d, name: [%.*s], value: [%.*s]",
|
"%u, stream: %d, name: [%.*s], value: [%.*s]",
|
||||||
frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
|
frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
|
||||||
@ -3626,8 +3629,9 @@ static int inflate_header_block(nghttp2_session *session, nghttp2_frame *frame,
|
|||||||
nv.name->base, (int)nv.value->len, nv.value->base);
|
nv.name->base, (int)nv.value->len, nv.value->base);
|
||||||
|
|
||||||
rv = session_call_error_callback(
|
rv = session_call_error_callback(
|
||||||
session, "Invalid HTTP header field was received: frame type: "
|
session, NGHTTP2_ERR_HTTP_HEADER,
|
||||||
"%u, stream: %d, name: [%.*s], value: [%.*s]",
|
"Invalid HTTP header field was received: frame type: "
|
||||||
|
"%u, stream: %d, name: [%.*s], value: [%.*s]",
|
||||||
frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
|
frame->hd.type, frame->hd.stream_id, (int)nv.name->len,
|
||||||
nv.name->base, (int)nv.value->len, nv.value->base);
|
nv.name->base, (int)nv.value->len, nv.value->base);
|
||||||
|
|
||||||
@ -3781,7 +3785,7 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session,
|
|||||||
session, frame, NGHTTP2_ERR_PROTO, "request HEADERS: stream_id == 0");
|
session, frame, NGHTTP2_ERR_PROTO, "request HEADERS: stream_id == 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If client recieves idle stream from server, it is invalid
|
/* If client receives idle stream from server, it is invalid
|
||||||
regardless stream ID is even or odd. This is because client is
|
regardless stream ID is even or odd. This is because client is
|
||||||
not expected to receive request from server. */
|
not expected to receive request from server. */
|
||||||
if (!session->server) {
|
if (!session->server) {
|
||||||
@ -5345,9 +5349,10 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
|
|||||||
iframe->state = NGHTTP2_IB_IGN_ALL;
|
iframe->state = NGHTTP2_IB_IGN_ALL;
|
||||||
|
|
||||||
rv = session_call_error_callback(
|
rv = session_call_error_callback(
|
||||||
session, "Remote peer returned unexpected data while we expected "
|
session, NGHTTP2_ERR_SETTINGS_EXPECTED,
|
||||||
"SETTINGS frame. Perhaps, peer does not support HTTP/2 "
|
"Remote peer returned unexpected data while we expected "
|
||||||
"properly.");
|
"SETTINGS frame. Perhaps, peer does not support HTTP/2 "
|
||||||
|
"properly.");
|
||||||
|
|
||||||
if (nghttp2_is_fatal(rv)) {
|
if (nghttp2_is_fatal(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -5588,13 +5593,13 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
|
|||||||
if (iframe->payloadleft) {
|
if (iframe->payloadleft) {
|
||||||
nghttp2_settings_entry *min_header_table_size_entry;
|
nghttp2_settings_entry *min_header_table_size_entry;
|
||||||
|
|
||||||
/* We allocate iv with addtional one entry, to store the
|
/* We allocate iv with additional one entry, to store the
|
||||||
minimum header table size. */
|
minimum header table size. */
|
||||||
iframe->max_niv =
|
iframe->max_niv =
|
||||||
iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1;
|
iframe->frame.hd.length / NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH + 1;
|
||||||
|
|
||||||
iframe->iv = nghttp2_mem_malloc(
|
iframe->iv = nghttp2_mem_malloc(mem, sizeof(nghttp2_settings_entry) *
|
||||||
mem, sizeof(nghttp2_settings_entry) * iframe->max_niv);
|
iframe->max_niv);
|
||||||
|
|
||||||
if (!iframe->iv) {
|
if (!iframe->iv) {
|
||||||
return NGHTTP2_ERR_NOMEM;
|
return NGHTTP2_ERR_NOMEM;
|
||||||
|
6
deps/nghttp2/lib/nghttp2_session.h
vendored
6
deps/nghttp2/lib/nghttp2_session.h
vendored
@ -319,7 +319,7 @@ struct nghttp2_session {
|
|||||||
uint8_t pending_enable_push;
|
uint8_t pending_enable_push;
|
||||||
/* Nonzero if the session is server side. */
|
/* Nonzero if the session is server side. */
|
||||||
uint8_t server;
|
uint8_t server;
|
||||||
/* Flags indicating GOAWAY is sent and/or recieved. The flags are
|
/* Flags indicating GOAWAY is sent and/or received. The flags are
|
||||||
composed by bitwise OR-ing nghttp2_goaway_flag. */
|
composed by bitwise OR-ing nghttp2_goaway_flag. */
|
||||||
uint8_t goaway_flags;
|
uint8_t goaway_flags;
|
||||||
/* This flag is used to reduce excessive queuing of WINDOW_UPDATE to
|
/* This flag is used to reduce excessive queuing of WINDOW_UPDATE to
|
||||||
@ -722,7 +722,7 @@ int nghttp2_session_on_goaway_received(nghttp2_session *session,
|
|||||||
nghttp2_frame *frame);
|
nghttp2_frame *frame);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when WINDOW_UPDATE is recieved, assuming |frame| is properly
|
* Called when WINDOW_UPDATE is received, assuming |frame| is properly
|
||||||
* initialized.
|
* initialized.
|
||||||
*
|
*
|
||||||
* This function returns 0 if it succeeds, or one of the following
|
* This function returns 0 if it succeeds, or one of the following
|
||||||
@ -737,7 +737,7 @@ int nghttp2_session_on_window_update_received(nghttp2_session *session,
|
|||||||
nghttp2_frame *frame);
|
nghttp2_frame *frame);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when ALTSVC is recieved, assuming |frame| is properly
|
* Called when ALTSVC is received, assuming |frame| is properly
|
||||||
* initialized.
|
* initialized.
|
||||||
*
|
*
|
||||||
* This function returns 0 if it succeeds, or one of the following
|
* This function returns 0 if it succeeds, or one of the following
|
||||||
|
12
deps/nghttp2/lib/nghttp2_stream.c
vendored
12
deps/nghttp2/lib/nghttp2_stream.c
vendored
@ -366,8 +366,9 @@ static void check_queued(nghttp2_stream *stream) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (queued == 0) {
|
if (queued == 0) {
|
||||||
fprintf(stderr, "stream(%p)=%d, stream->queued == 1, and "
|
fprintf(stderr,
|
||||||
"!stream_active(), but no descendants is queued\n",
|
"stream(%p)=%d, stream->queued == 1, and "
|
||||||
|
"!stream_active(), but no descendants is queued\n",
|
||||||
stream, stream->stream_id);
|
stream, stream->stream_id);
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
@ -378,9 +379,10 @@ static void check_queued(nghttp2_stream *stream) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (stream_active(stream) || !nghttp2_pq_empty(&stream->obq)) {
|
if (stream_active(stream) || !nghttp2_pq_empty(&stream->obq)) {
|
||||||
fprintf(stderr, "stream(%p) = %d, stream->queued == 0, but "
|
fprintf(stderr,
|
||||||
"stream_active(stream) == %d and "
|
"stream(%p) = %d, stream->queued == 0, but "
|
||||||
"nghttp2_pq_size(&stream->obq) = %zu\n",
|
"stream_active(stream) == %d and "
|
||||||
|
"nghttp2_pq_size(&stream->obq) = %zu\n",
|
||||||
stream, stream->stream_id, stream_active(stream),
|
stream, stream->stream_id, stream_active(stream),
|
||||||
nghttp2_pq_size(&stream->obq));
|
nghttp2_pq_size(&stream->obq));
|
||||||
assert(0);
|
assert(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user