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

[8.x] Backport http2 changes from 9.x #20456

Closed
wants to merge 77 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
0d7ce68
src: minor refactoring to StreamBase writes
addaleax Dec 9, 2017
16a3ad0
src: replace SetAccessor w/ SetAccessorProperty
jure Dec 13, 2017
c4572cc
test: add hasCrypto when using binding('crypto')
danbev Dec 26, 2017
9557fb9
test: make test-tls-external-accessor agnostic
Trott Oct 17, 2017
d5ddbd9
perf_hooks: refactor internals
jasnell Dec 21, 2017
ed53cb7
http2: simplify onSelectPadding
addaleax Dec 17, 2017
14d0bab
deps: update nghttp2 to 1.29.0
jasnell Dec 28, 2017
584379f
src: add optional keep-alive object to SetImmediate
addaleax Nov 21, 2017
e725a4a
http2: don't call into JS from GC
addaleax Nov 21, 2017
2d389f9
http2: only schedule write when necessary
addaleax Nov 21, 2017
367b848
http2: be sure to destroy the Http2Stream
jasnell Nov 27, 2017
988f11f
http2: cleanup Http2Stream/Http2Session destroy
jasnell Dec 12, 2017
10e9b9d
http2: remove redundant write indirection
addaleax Dec 17, 2017
93d00ab
http2: refactor outgoing write mechanism
addaleax Dec 17, 2017
f68325c
http2: convert Http2Settings to an AsyncWrap
jasnell Dec 18, 2017
5036d0f
http2: fix compiling with `--debug-http2`
addaleax Dec 25, 2017
3490359
http2: keep session objects alive during Http2Scope
addaleax Dec 25, 2017
3bf3eb8
http2: implement ref() and unref() on client sessions
kjin Dec 11, 2017
e92be6a
http2: perf_hooks integration
jasnell Dec 20, 2017
7767aaa
http2,perf_hooks: perf state using AliasedBuffer
kfarnung Jan 22, 2018
936337a
http2: strictly limit number on concurrent streams
jasnell Nov 21, 2017
644bd5f
http2: add altsvc support
jasnell Dec 29, 2017
6466ac1
tls: set servername on client side too
jasnell Jan 1, 2018
fc97666
http2: add initial support for originSet
jasnell Jan 1, 2018
08f599b
http2: add aligned padding strategy
jasnell Jan 1, 2018
3601bc4
http2: properly handle already closed stream error
jasnell Jan 2, 2018
21c0a8c
doc: add docs for common/http2.js utility
jasnell Jan 2, 2018
098d052
src: silence http2 -Wunused-result warnings
cjihrig Jan 2, 2018
3a5e97f
http2: implement maxSessionMemory
jasnell Jan 3, 2018
b3d09de
http2: verify that a dependency cycle may exist
jasnell Jan 3, 2018
26c8b3c
doc: grammar fixes in http2.md
Trott Jan 4, 2018
0954785
http2: verify flood error and unsolicited frames
jasnell Jan 3, 2018
5fe065b
doc: correct spelling
sreepurnajasti Dec 29, 2017
ea21157
doc: fix code nits in common/README
vsemozhetbyt Jan 4, 2018
b768f6f
doc: re-alphabetise sections in common/README.md
vsemozhetbyt Jan 4, 2018
4eb9cca
doc: compact eslint directives in common/README
vsemozhetbyt Jan 4, 2018
39a0d35
http2: use aliased buffer for perf stats, add stats
jasnell Jan 6, 2018
3d13a16
doc: update pushStream docs to use err first
jasnell Jan 10, 2018
de1e52e
doc: fix s/rstStream/close in example
jasnell Jan 11, 2018
6a24afd
perf_hooks,http2: add performance.clear()
jasnell Jan 8, 2018
1d5ab00
http2: remember sent headers
jasnell Jan 8, 2018
39e27fd
src: remove declarations for missing functions
addaleax Jan 13, 2018
dcb986e
src,doc,test: Fix common misspellings
silverwind Jan 14, 2018
3535f6f
doc: fix typo in http2stream.close param default
maritz Jan 15, 2018
f494635
src: introduce internal buffer slice constructor
addaleax Jan 8, 2018
cf46b95
http2: refactor read mechanism
addaleax Jan 8, 2018
9ff0e8c
http2: add checks for server close callback
jasnell Jan 16, 2018
4d7549b
doc: fix documentation of http2Stream.pushstream()
nephross Jan 19, 2018
c8a6d8a
doc: unify type linkification
vsemozhetbyt Jan 27, 2018
bcfef86
doc: remove removed apis from http2 docs
kjin Jan 29, 2018
b83c03e
doc: fix typo in http2.md
vsemozhetbyt Feb 6, 2018
7e26992
http2: add http fallback options to .createServer
hekike Oct 27, 2017
740d445
http: add options to http.createServer()
Oct 19, 2017
7e2181a
http2: add req and res options to server creation
Oct 5, 2017
7b03c17
http2: use `_final` instead of `on('finish')`
addaleax Feb 7, 2018
a10b365
doc: warn against concurrent http2stream.respondWithFD
addaleax Feb 13, 2018
c32ac60
src: add nullptr check for session in DEBUG macro
danbev Feb 16, 2018
7c2bc72
doc: fix typo in http2.md
vsemozhetbyt Feb 19, 2018
ab416d7
deps,src: align ssize_t ABI between Node & nghttp2
addaleax Feb 4, 2018
0cdcd58
http2: fix condition where data is lost
mcollina Feb 19, 2018
265baaf
http2: send error text in case of ALPN mismatch
addaleax Feb 25, 2018
78b6542
http2: use original error for cancelling pending streams
addaleax Feb 25, 2018
c46ee1f
http2: fix endless loop when writing empty string
addaleax Feb 22, 2018
74212aa
test: check endless loop while writing empty string
XadillaX Feb 11, 2018
16e9b8d
http2: fix flaky test-http2-https-fallback
mcollina Mar 2, 2018
4188136
http2: no stream destroy while its data is on the wire
addaleax Feb 26, 2018
89c42a3
doc: add note about browsers and HTTP/2
styfle Mar 20, 2018
c0c9664
http2: remove some unnecessary next ticks
jasnell Mar 19, 2018
f6387a4
doc: rename HTTP2 to HTTP/2
TimothyGu Mar 26, 2018
3ba1beb
test: http2 stream.respond() error checks
trivikr Feb 19, 2018
d932237
http2: destroy() stream, upon errnoException
SirR4T Mar 16, 2018
0682140
doc: guard against md list parsing edge case
vsemozhetbyt Mar 28, 2018
9d885b9
test: http2 errors on req.close()
trivikr Feb 18, 2018
dedf0c0
http2: callback valid check before closing request
trivikr Feb 28, 2018
7d3ff81
doc, http2: add sections for server.close()
chrismilleruk Apr 4, 2018
c53bc0f
doc: add Http2Session.connecting property
pietermees Apr 6, 2018
b2fd504
http2: emit session connect on next tick
pietermees Apr 9, 2018
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: 4 additions & 0 deletions deps/nghttp2/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ set_target_properties(nghttp2 PROPERTIES
VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
C_VISIBILITY_PRESET hidden
)
target_include_directories(nghttp2 INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}/includes"
"${CMAKE_CURRENT_SOURCE_DIR}/includes"
)

if(HAVE_CUNIT)
# Static library (for unittests because of symbol visibility)
Expand Down
14 changes: 12 additions & 2 deletions deps/nghttp2/lib/includes/config.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
/* Hint to the compiler that a function never returns */
#define NGHTTP2_NORETURN

/* Define to `int' if <sys/types.h> does not define. */
#define ssize_t int
/* Edited to match src/node.h. */
#include <stdint.h>

#ifdef _WIN32
#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
typedef intptr_t ssize_t;
# define _SSIZE_T_
# define _SSIZE_T_DEFINED
#endif
#else // !_WIN32
# include <sys/types.h> // size_t, ssize_t
#endif // _WIN32

/* Define to 1 if you have the `std::map::emplace`. */
#define HAVE_STD_MAP_EMPLACE 1
Expand Down
63 changes: 59 additions & 4 deletions deps/nghttp2/lib/includes/nghttp2/nghttp2.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ typedef enum {
* Indicates that a processing was canceled.
*/
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
* under unexpected condition and processing was terminated (e.g.,
Expand Down Expand Up @@ -1987,6 +1992,9 @@ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session,
* of length |len|. |len| does not include the sentinel NULL
* character.
*
* This function is deprecated. The new application should use
* :type:`nghttp2_error_callback2`.
*
* The format of error message may change between nghttp2 library
* versions. The application should not depend on the particular
* format.
Expand All @@ -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,
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;

/**
Expand Down Expand Up @@ -2267,10 +2302,30 @@ nghttp2_session_callbacks_set_on_extension_chunk_recv_callback(
*
* Sets callback function invoked when library tells error message to
* 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_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
*
Expand Down Expand Up @@ -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|.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
* This function returns the number of bytes written to |buf| if it
* succeeds, or one of the following negative error codes:
*
* :enum:`NGHTTP2_ERR_NOMEM`
* Out of memory.
Expand Down Expand Up @@ -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|.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
* This function returns the number of bytes written to |vec| if it
* succeeds, or one of the following negative error codes:
*
* :enum:`NGHTTP2_ERR_NOMEM`
* Out of memory.
Expand Down
4 changes: 2 additions & 2 deletions deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
* @macro
* Version number of the nghttp2 library release
*/
#define NGHTTP2_VERSION "1.25.0"
#define NGHTTP2_VERSION "1.29.0"

/**
* @macro
* Numerical representation of the version number of the nghttp2 library
* 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.
*/
#define NGHTTP2_VERSION_NUM 0x011900
#define NGHTTP2_VERSION_NUM 0x011d00

#endif /* NGHTTP2VER_H */
2 changes: 1 addition & 1 deletion deps/nghttp2/lib/nghttp2_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ int nghttp2_bufs_advance(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);

Expand Down
5 changes: 5 additions & 0 deletions deps/nghttp2/lib/nghttp2_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,8 @@ void nghttp2_session_callbacks_set_error_callback(
nghttp2_session_callbacks *cbs, nghttp2_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 change: 1 addition & 0 deletions deps/nghttp2/lib/nghttp2_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct nghttp2_session_callbacks {
nghttp2_unpack_extension_callback unpack_extension_callback;
nghttp2_on_extension_chunk_recv_callback on_extension_chunk_recv_callback;
nghttp2_error_callback error_callback;
nghttp2_error_callback2 error_callback2;
};

#endif /* NGHTTP2_CALLBACKS_H */
4 changes: 3 additions & 1 deletion deps/nghttp2/lib/nghttp2_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
#define NGHTTP2_MAX_PADLEN 256

/* 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);

Expand Down
6 changes: 4 additions & 2 deletions deps/nghttp2/lib/nghttp2_hd.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ typedef struct {

#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 {
nghttp2_hd_context ctx;
Expand Down Expand Up @@ -313,7 +315,7 @@ void nghttp2_hd_deflate_free(nghttp2_hd_deflater *deflater);
*
* This function expands |bufs| as necessary to store the result. If
* 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|.
*
Expand Down
3 changes: 3 additions & 0 deletions deps/nghttp2/lib/nghttp2_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ const char *nghttp2_strerror(int error_code) {
return "Internal error";
case NGHTTP2_ERR_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:
return "Out of memory";
case NGHTTP2_ERR_CALLBACK_FAILURE:
Expand Down
2 changes: 1 addition & 1 deletion deps/nghttp2/lib/nghttp2_outbound_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ struct nghttp2_outbound_item {
nghttp2_ext_frame_payload ext_frame_payload;
nghttp2_aux_data aux_data;
/* 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.
For DATA frame, cycle is computed by taking into account of
effective weight and frame payload length previously sent, so
Expand Down
6 changes: 4 additions & 2 deletions deps/nghttp2/lib/nghttp2_pq.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@

/* Implementation of priority queue */

typedef struct { size_t index; } nghttp2_pq_entry;
typedef struct {
size_t index;
} nghttp2_pq_entry;

typedef struct {
/* The pointer to the pointer to the item stored */
Expand Down Expand Up @@ -71,7 +73,7 @@ void nghttp2_pq_free(nghttp2_pq *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:
*
* NGHTTP2_ERR_NOMEM
Expand Down
4 changes: 3 additions & 1 deletion deps/nghttp2/lib/nghttp2_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ typedef struct nghttp2_queue_cell {
struct nghttp2_queue_cell *next;
} 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_free(nghttp2_queue *queue);
Expand Down
Loading