diff options
author | Denys Otrishko <shishugi@gmail.com> | 2019-11-18 22:44:21 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-11-30 05:57:19 +0300 |
commit | 092a3c28aa2c270092cab3c9da766b60702fe8df (patch) | |
tree | 6e4846900953727acf199faea25ae21e645276b7 /src/node_http2.cc | |
parent | e92afd998fc92e6f86239888ce0232beadf7081e (diff) |
http2: allow to configure maximum tolerated invalid frames
PR-URL: https://github.com/nodejs/node/pull/30534
Fixes: https://github.com/nodejs/node/issues/30505
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_http2.cc')
-rw-r--r-- | src/node_http2.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/node_http2.cc b/src/node_http2.cc index 4c1e5dd5831..459cc3b0e60 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1011,8 +1011,12 @@ int Http2Session::OnInvalidFrame(nghttp2_session* handle, void* user_data) { Http2Session* session = static_cast<Http2Session*>(user_data); - Debug(session, "invalid frame received, code: %d", lib_error_code); - if (session->invalid_frame_count_++ > 1000) + Debug(session, + "invalid frame received (%u/%u), code: %d", + session->invalid_frame_count_, + session->js_fields_.max_invalid_frames, + lib_error_code); + if (session->invalid_frame_count_++ > session->js_fields_.max_invalid_frames) return 1; // If the error is fatal or if error code is ERR_STREAM_CLOSED... emit error @@ -3057,6 +3061,7 @@ void Initialize(Local<Object> target, NODE_DEFINE_CONSTANT(target, kBitfield); NODE_DEFINE_CONSTANT(target, kSessionPriorityListenerCount); NODE_DEFINE_CONSTANT(target, kSessionFrameErrorListenerCount); + NODE_DEFINE_CONSTANT(target, kSessionMaxInvalidFrames); NODE_DEFINE_CONSTANT(target, kSessionUint8FieldCount); NODE_DEFINE_CONSTANT(target, kSessionHasRemoteSettingsListeners); |