diff options
author | James M Snell <jasnell@gmail.com> | 2017-11-01 11:48:11 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-11-04 22:32:44 -0700 |
commit | 9f3d59eabb6564ad337a762d61ac767f9130e8a5 (patch) | |
tree | a0fdb43c530be18d6ed5dded16378c6f30d91da6 /src/node_http2.h | |
parent | 1f045f491a6a8d6ac193474f3856e2bdbd6847be (diff) | |
download | android-node-v8-9f3d59eabb6564ad337a762d61ac767f9130e8a5.tar.gz android-node-v8-9f3d59eabb6564ad337a762d61ac767f9130e8a5.tar.bz2 android-node-v8-9f3d59eabb6564ad337a762d61ac767f9130e8a5.zip |
http2: refactor multiple internals
* eliminate pooling of Nghttp2Stream instances. After testing,
the pooling is not having any tangible benefit
and makes things more complicated. Simplify. Simplify.
* refactor inbound headers
* Enforce MAX_HEADERS_LIST setting and limit the number of header
pairs accepted from the peer. Use the ENHANCE_YOUR_CALM error
code when receiving either too many headers or too many octets.
Use a vector to store the headers instead of a queue
PR-URL: https://github.com/nodejs/node/pull/16676
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_http2.h')
-rw-r--r-- | src/node_http2.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/node_http2.h b/src/node_http2.h index a19e032cce..9454301ec4 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -292,14 +292,6 @@ const char* nghttp2_errname(int rv) { } } -#define DEFAULT_SETTINGS_HEADER_TABLE_SIZE 4096 -#define DEFAULT_SETTINGS_ENABLE_PUSH 1 -#define DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE 65535 -#define DEFAULT_SETTINGS_MAX_FRAME_SIZE 16384 -#define MAX_MAX_FRAME_SIZE 16777215 -#define MIN_MAX_FRAME_SIZE DEFAULT_SETTINGS_MAX_FRAME_SIZE -#define MAX_INITIAL_WINDOW_SIZE 2147483647 - // This allows for 4 default-sized frames with their frame headers static const size_t kAllocBufferSize = 4 * (16384 + 9); @@ -324,19 +316,25 @@ class Http2Options { return options_; } + void SetMaxHeaderPairs(uint32_t max) { + max_header_pairs_ = max; + } + + uint32_t GetMaxHeaderPairs() const { + return max_header_pairs_; + } + void SetPaddingStrategy(padding_strategy_type val) { -#if DEBUG - CHECK_LE(val, PADDING_STRATEGY_CALLBACK); -#endif padding_strategy_ = static_cast<padding_strategy_type>(val); } - padding_strategy_type GetPaddingStrategy() { + padding_strategy_type GetPaddingStrategy() const { return padding_strategy_; } private: nghttp2_option* options_; + uint32_t max_header_pairs_ = DEFAULT_MAX_HEADER_LIST_PAIRS; padding_strategy_type padding_strategy_ = PADDING_STRATEGY_NONE; }; @@ -413,7 +411,8 @@ class Http2Session : public AsyncWrap, void OnHeaders( Nghttp2Stream* stream, - std::queue<nghttp2_header>* headers, + nghttp2_header* headers, + size_t count, nghttp2_headers_category cat, uint8_t flags) override; void OnStreamClose(int32_t id, uint32_t code) override; |