From 9590f577b03f621faf35f60e439b87431d293dee Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Mon, 18 Nov 2019 21:44:21 +0200 Subject: 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 Reviewed-By: David Carlier Reviewed-By: James M Snell --- src/node_http2.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/node_http2.h') diff --git a/src/node_http2.h b/src/node_http2.h index 61092b60c0..79d648276f 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -677,6 +677,7 @@ typedef struct { uint8_t bitfield; uint8_t priority_listener_count; uint8_t frame_error_listener_count; + uint32_t max_invalid_frames = 1000; } SessionJSFields; // Indices for js_fields_, which serves as a way to communicate data with JS @@ -689,6 +690,7 @@ enum SessionUint8Fields { offsetof(SessionJSFields, priority_listener_count), kSessionFrameErrorListenerCount = offsetof(SessionJSFields, frame_error_listener_count), + kSessionMaxInvalidFrames = offsetof(SessionJSFields, max_invalid_frames), kSessionUint8FieldCount = sizeof(SessionJSFields) }; @@ -1024,7 +1026,7 @@ class Http2Session : public AsyncWrap, public StreamListener { // accepted again. int32_t rejected_stream_count_ = 0; // Also use the invalid frame count as a measure for rejecting input frames. - int32_t invalid_frame_count_ = 0; + uint32_t invalid_frame_count_ = 0; void PushOutgoingBuffer(nghttp2_stream_write&& write); void CopyDataIntoOutgoing(const uint8_t* src, size_t src_length); -- cgit v1.2.3