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

Allow disabling HTTP/2 priority frames limit #5888

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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