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 10.x #22850

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
141f166
http2: fix ping duration calculation
jasnell Apr 11, 2018
f3f4ee6
doc: close event does not take arguments
indranil Apr 14, 2018
ecc2a70
http2: refactor how trailers are done
jasnell Apr 11, 2018
8786251
test: remove message from strictEqual assertions
bryancr89 Apr 19, 2018
b01edd2
doc,http2: add parameters for Http2Session:connect event
ryzokuken Apr 21, 2018
19e41a6
test: add strictEqual method to assert
9christine Apr 21, 2018
ac14fec
doc: add parameters for Http2Session:error event
ryzokuken Apr 21, 2018
110ac58
doc: improve docs for Http2Session:frameError
ryzokuken Apr 23, 2018
df3e6d9
http: added aborted property to request
ronag Apr 17, 2018
4fbd216
test: removed assert.strictEqual message
kailashyogeshwar85 Apr 23, 2018
d0594df
doc: improve parameters for Http2Session:goaway event
ryzokuken Apr 26, 2018
7bb1a8c
http2: fix responses to long payload reqs
apapirovski Apr 16, 2018
cdbf96f
http2: fix ping callback
BridgeAR Apr 26, 2018
07aab18
test: verify arguments length in common.expectsError
BridgeAR Apr 26, 2018
c9865ff
doc: add parameters for settings events
ryzokuken Apr 27, 2018
d9efc87
http2: reduce require calls in http2/core
danbev Apr 30, 2018
ce96ad0
http2: rename http2_state class to Http2State
danbev Apr 30, 2018
807807f
doc: add parameters for Http2Session:stream event
ryzokuken May 5, 2018
7d23d63
test: fix flaky http2-flow-control test
apapirovski May 6, 2018
e3e16d7
doc: add params for ClientHttp2Session:altsvc
ryzokuken May 8, 2018
776c3d0
doc: add parameters for Http2Stream:error event
ryzokuken May 8, 2018
11f194f
http2: avoid bind and properly clean up in compat
ronag Apr 27, 2018
9cf40c5
test: improve reliability of http2-session-timeout
Trott May 11, 2018
2238e12
http2: fix end without read
apapirovski May 9, 2018
c9f8d6f
net,http2: refactor _write and _writev
ryzokuken May 9, 2018
4ef2393
doc: fix typo in http2.md
kakts May 20, 2018
2151bf3
http2: fix several serious bugs
apapirovski May 17, 2018
e825eed
test: fix flaky http2-session-unref
apapirovski May 21, 2018
830cc57
http2: delay closing stream
apapirovski May 28, 2018
21f3e27
http2: force through RST_STREAM in destroy
apapirovski May 29, 2018
b53a753
test: minor adjustments to test-http2-respond-file
addaleax Jun 2, 2018
3a34ebd
http2: fix premature destroy
apapirovski May 31, 2018
3d38b99
http2: safer Http2Session destructor
apapirovski Jun 6, 2018
4d46e35
http2: fix memory leak for uncommon headers
addaleax Jun 15, 2018
78c7fc4
http2: fix memory leak when headers are not emitted
addaleax Jun 16, 2018
f8ca564
http2: track memory allocated by nghttp2
addaleax Jun 14, 2018
9e64f91
doc: Improve doc for Http2 headers object
Flarna Jun 12, 2018
6bdee91
http2: pass incoming set-cookie header as array
Flarna Jun 15, 2018
00002a6
doc: fix http2stream.pushStream error doc
ChALkeR Jun 23, 2018
823b31e
http2: order declarations in core.js
Trott Jul 6, 2018
a9053fa
errors: fix undefined HTTP2 and tls errors
thatshailesh Jun 27, 2018
9a0d117
http2: remove `waitTrailers` listener after closing a stream
RidgeA Jul 11, 2018
41edcf4
doc: add missing `require` to example in http2.md
kevinsimper Jul 17, 2018
d78a7b3
http2: remove unused nghttp2 error list
addaleax Jul 15, 2018
aa4c19b
http2: release request()'s "connect" event listener after it runs
ide Jul 21, 2018
833ef17
test: refactor test-http2-compat-serverresponse-finished.js
antsmartian Jul 28, 2018
23b53e7
test: improve reliability in http2-session-timeout
Trott Jul 30, 2018
07ef45d
http2: remove `streamError` from docs
jasnell Aug 10, 2018
411acb7
doc: clarify http2 docs around class exports
jasnell Aug 10, 2018
ee3e471
http2: avoid race condition in OnHeaderCallback
jasnell Aug 10, 2018
81f3ebc
test: add test-http2-large-file sequential test
jasnell Aug 10, 2018
f1e310e
http2: explicitly disallow nested push streams
jasnell Aug 10, 2018
3dc84ca
http2: emit timeout on compat request and response
jasnell Aug 10, 2018
28cd408
doc: make createPushResponse() more detailled
Aug 17, 2018
391e30a
doc: simplify http2 wording and formatting
Trott Aug 26, 2018
3640568
http2: throw better error when accessing unbound socket proxy
jasnell Aug 23, 2018
f6d9bf3
deps: update to nghttp2 1.33.0
addaleax Sep 2, 2018
62ce017
http2: don't expose the original socket through the socket proxy
szmarczak Sep 2, 2018
f9cd2d5
doc: document http2 timeouts
sagitsofan Sep 10, 2018
565d9d8
http2: add http2stream.endAfterHeaders property
jasnell Sep 13, 2018
2fd285a
http2: check if stream is not destroyed before sending trailers
mcollina Sep 17, 2018
bdaccc9
http2: add origin frame support
jasnell Sep 17, 2018
48d8766
http2: do not falsely emit 'aborted' on push
apapirovski Sep 15, 2018
40a8814
http2: add ping event
jasnell Sep 21, 2018
593f8d9
test: remove setImmediate from timeout test
Trott Sep 24, 2018
4f46d4b
test: improve debugging information for http2 test
Trott Sep 24, 2018
19e925b
http2: graduate from experimental
jasnell Aug 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
142 changes: 112 additions & 30 deletions deps/nghttp2/lib/includes/nghttp2/nghttp2.h
Expand Up @@ -28,7 +28,7 @@
/* Define WIN32 when build target is Win32 API (borrowed from
libcurl) */
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
#define WIN32
# define WIN32
#endif

#ifdef __cplusplus
Expand All @@ -40,30 +40,30 @@ extern "C" {
/* MSVC < 2013 does not have inttypes.h because it is not C99
compliant. See compiler macros and version number in
https://sourceforge.net/p/predef/wiki/Compilers/ */
#include <stdint.h>
# include <stdint.h>
#else /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
#include <inttypes.h>
# include <inttypes.h>
#endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
#include <sys/types.h>
#include <stdarg.h>

#include <nghttp2/nghttp2ver.h>

#ifdef NGHTTP2_STATICLIB
#define NGHTTP2_EXTERN
# define NGHTTP2_EXTERN
#elif defined(WIN32)
#ifdef BUILDING_NGHTTP2
#define NGHTTP2_EXTERN __declspec(dllexport)
#else /* !BUILDING_NGHTTP2 */
#define NGHTTP2_EXTERN __declspec(dllimport)
#endif /* !BUILDING_NGHTTP2 */
#else /* !defined(WIN32) */
#ifdef BUILDING_NGHTTP2
#define NGHTTP2_EXTERN __attribute__((visibility("default")))
#else /* !BUILDING_NGHTTP2 */
#define NGHTTP2_EXTERN
#endif /* !BUILDING_NGHTTP2 */
#endif /* !defined(WIN32) */
# ifdef BUILDING_NGHTTP2
# define NGHTTP2_EXTERN __declspec(dllexport)
# else /* !BUILDING_NGHTTP2 */
# define NGHTTP2_EXTERN __declspec(dllimport)
# endif /* !BUILDING_NGHTTP2 */
#else /* !defined(WIN32) */
# ifdef BUILDING_NGHTTP2
# define NGHTTP2_EXTERN __attribute__((visibility("default")))
# else /* !BUILDING_NGHTTP2 */
# define NGHTTP2_EXTERN
# endif /* !BUILDING_NGHTTP2 */
#endif /* !defined(WIN32) */

/**
* @macro
Expand Down Expand Up @@ -611,7 +611,12 @@ typedef enum {
* The ALTSVC frame, which is defined in `RFC 7383
* <https://tools.ietf.org/html/rfc7838#section-4>`_.
*/
NGHTTP2_ALTSVC = 0x0a
NGHTTP2_ALTSVC = 0x0a,
/**
* The ORIGIN frame, which is defined by `RFC 8336
* <https://tools.ietf.org/html/rfc8336>`_.
*/
NGHTTP2_ORIGIN = 0x0c
} nghttp2_frame_type;

/**
Expand Down Expand Up @@ -2473,15 +2478,15 @@ nghttp2_option_set_no_auto_window_update(nghttp2_option *option, int val);
*
* This option sets the SETTINGS_MAX_CONCURRENT_STREAMS value of
* remote endpoint as if it is received in SETTINGS frame. Without
* specifying this option, before the local endpoint receives
* SETTINGS_MAX_CONCURRENT_STREAMS in SETTINGS frame from remote
* endpoint, SETTINGS_MAX_CONCURRENT_STREAMS is unlimited. This may
* cause problem if local endpoint submits lots of requests initially
* and sending them at once to the remote peer may lead to the
* rejection of some requests. Specifying this option to the sensible
* value, say 100, may avoid this kind of issue. This value will be
* overwritten if the local endpoint receives
* SETTINGS_MAX_CONCURRENT_STREAMS from the remote endpoint.
* specifying this option, the maximum number of outgoing concurrent
* streams is initially limited to 100 to avoid issues when the local
* endpoint submits lots of requests before receiving initial SETTINGS
* frame from the remote endpoint, since sending them at once to the
* remote endpoint could lead to rejection of some of the requests.
* This value will be overwritten when the local endpoint receives
* initial SETTINGS frame from the remote endpoint, either to the
* value advertised in SETTINGS_MAX_CONCURRENT_STREAMS or to the
* default value (unlimited) if none was advertised.
*/
NGHTTP2_EXTERN void
nghttp2_option_set_peer_max_concurrent_streams(nghttp2_option *option,
Expand Down Expand Up @@ -3797,10 +3802,13 @@ nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec);
* .. warning::
*
* This function returns assigned stream ID if it succeeds. But
* that stream is not opened yet. The application must not submit
* that stream is not created yet. The application must not submit
* frame to that stream ID before
* :type:`nghttp2_before_frame_send_callback` is called for this
* frame.
* frame. This means `nghttp2_session_get_stream_user_data()` does
* not work before the callback. But
* `nghttp2_session_set_stream_user_data()` handles this situation
* specially, and it can set data to a stream during this period.
*
*/
NGHTTP2_EXTERN int32_t nghttp2_submit_request(
Expand Down Expand Up @@ -4516,8 +4524,7 @@ typedef struct {
* Submits ALTSVC frame.
*
* ALTSVC frame is a non-critical extension to HTTP/2, and defined in
* is defined in `RFC 7383
* <https://tools.ietf.org/html/rfc7838#section-4>`_.
* `RFC 7383 <https://tools.ietf.org/html/rfc7838#section-4>`_.
*
* The |flags| is currently ignored and should be
* :enum:`NGHTTP2_FLAG_NONE`.
Expand Down Expand Up @@ -4551,6 +4558,81 @@ NGHTTP2_EXTERN int nghttp2_submit_altsvc(nghttp2_session *session,
const uint8_t *field_value,
size_t field_value_len);

/**
* @struct
*
* The single entry of an origin.
*/
typedef struct {
/**
* The pointer to origin. No validation is made against this field
* by the library. This is not necessarily NULL-terminated.
*/
uint8_t *origin;
/**
* The length of the |origin|.
*/
size_t origin_len;
} nghttp2_origin_entry;

/**
* @struct
*
* The payload of ORIGIN frame. ORIGIN frame is a non-critical
* extension to HTTP/2 and defined by `RFC 8336
* <https://tools.ietf.org/html/rfc8336>`_.
*
* If this frame is received, and
* `nghttp2_option_set_user_recv_extension_type()` is not set, and
* `nghttp2_option_set_builtin_recv_extension_type()` is set for
* :enum:`NGHTTP2_ORIGIN`, ``nghttp2_extension.payload`` will point to
* this struct.
*
* It has the following members:
*/
typedef struct {
/**
* The number of origins contained in |ov|.
*/
size_t nov;
/**
* The pointer to the array of origins contained in ORIGIN frame.
*/
nghttp2_origin_entry *ov;
} nghttp2_ext_origin;

/**
* @function
*
* Submits ORIGIN frame.
*
* ORIGIN frame is a non-critical extension to HTTP/2 and defined by
* `RFC 8336 <https://tools.ietf.org/html/rfc8336>`_.
*
* The |flags| is currently ignored and should be
* :enum:`NGHTTP2_FLAG_NONE`.
*
* The |ov| points to the array of origins. The |nov| specifies the
* number of origins included in |ov|. This function creates copies
* of all elements in |ov|.
*
* The ORIGIN frame is only usable by a server. If this function is
* invoked with client side session, this function returns
* :enum:`NGHTTP2_ERR_INVALID_STATE`.
*
* :enum:`NGHTTP2_ERR_NOMEM`
* Out of memory
* :enum:`NGHTTP2_ERR_INVALID_STATE`
* The function is called from client side session.
* :enum:`NGHTTP2_ERR_INVALID_ARGUMENT`
* There are too many origins, or an origin is too large to fit
* into a default frame payload.
*/
NGHTTP2_EXTERN int nghttp2_submit_origin(nghttp2_session *session,
uint8_t flags,
const nghttp2_origin_entry *ov,
size_t nov);

/**
* @function
*
Expand Down
4 changes: 2 additions & 2 deletions deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
Expand Up @@ -29,14 +29,14 @@
* @macro
* Version number of the nghttp2 library release
*/
#define NGHTTP2_VERSION "1.32.0"
#define NGHTTP2_VERSION "1.33.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 0x012000
#define NGHTTP2_VERSION_NUM 0x012100

#endif /* NGHTTP2VER_H */
2 changes: 1 addition & 1 deletion deps/nghttp2/lib/nghttp2_buf.h
Expand Up @@ -26,7 +26,7 @@
#define NGHTTP2_BUF_H

#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif /* HAVE_CONFIG_H */

#include <nghttp2/nghttp2.h>
Expand Down
2 changes: 1 addition & 1 deletion deps/nghttp2/lib/nghttp2_callbacks.h
Expand Up @@ -26,7 +26,7 @@
#define NGHTTP2_CALLBACKS_H

#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif /* HAVE_CONFIG_H */

#include <nghttp2/nghttp2.h>
Expand Down
10 changes: 5 additions & 5 deletions deps/nghttp2/lib/nghttp2_debug.h
Expand Up @@ -26,18 +26,18 @@
#define NGHTTP2_DEBUG_H

#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif /* HAVE_CONFIG_H */

#include <nghttp2/nghttp2.h>

#ifdef DEBUGBUILD
#define DEBUGF(...) nghttp2_debug_vprintf(__VA_ARGS__)
# define DEBUGF(...) nghttp2_debug_vprintf(__VA_ARGS__)
void nghttp2_debug_vprintf(const char *format, ...);
#else
#define DEBUGF(...) \
do { \
} while (0)
# define DEBUGF(...) \
do { \
} while (0)
#endif

#endif /* NGHTTP2_DEBUG_H */