Skip to content

Commit

Permalink
Allow disabling HTTP/2 priority frames limit
Browse files Browse the repository at this point in the history
  • Loading branch information
jvgutierrez committed Sep 3, 2019
1 parent a1e6f5e commit cd4582c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion doc/admin-guide/files/records.config.en.rst
Expand Up @@ -3658,7 +3658,9 @@ HTTP/2 Configuration

Specifies how many number of PRIORITY frames |TS| receives for a minute at maximum.
Clients exceeded this limit will be immediately disconnected with an error
code of ENHANCE_YOUR_CALM.
code of ENHANCE_YOUR_CALM. If this is set to 0, the limit logic is disabled.
This limit only will be enforced if :ts:cv:`proxy.config.http2.stream_priority_enabled`
is set to 1.

.. ts:cv:: CONFIG proxy.config.http2.min_avg_window_update FLOAT 2560.0
:reloadable:
Expand Down
11 changes: 6 additions & 5 deletions proxy/http2/Http2ConnectionState.cc
Expand Up @@ -417,10 +417,15 @@ rcv_priority_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
"PRIORITY frame depends on itself");
}

if (!Http2::stream_priority_enabled) {
return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
}

// Update PRIORITY frame count per minute
cstate.increment_received_priority_frame_count();
// Close this conection if its priority frame count received exceeds a limit
if (cstate.get_received_priority_frame_count() > Http2::max_priority_frames_per_minute) {
if (Http2::max_priority_frames_per_minute != 0 &&
cstate.get_received_priority_frame_count() > Http2::max_priority_frames_per_minute) {
HTTP2_INCREMENT_THREAD_DYN_STAT(HTTP2_STAT_MAX_PRIORITY_FRAMES_PER_MINUTE_EXCEEDED, this_ethread());
Http2StreamDebug(cstate.ua_session, stream_id,
"Observed too frequent priority changes: %u priority changes within a last minute",
Expand All @@ -429,10 +434,6 @@ rcv_priority_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
"recv priority too frequent priority changes");
}

if (!Http2::stream_priority_enabled) {
return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
}

Http2StreamDebug(cstate.ua_session, stream_id, "PRIORITY - dep: %d, weight: %d, excl: %d, tree size: %d",
priority.stream_dependency, priority.weight, priority.exclusive_flag, cstate.dependency_tree->size());

Expand Down

0 comments on commit cd4582c

Please sign in to comment.