This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new f9e69ef  Allow disabling HTTP/2 priority frames limit
f9e69ef is described below

commit f9e69ef10b94290a3ce1ed015fc505c68698d14f
Author: Valentin Gutierrez <[email protected]>
AuthorDate: Wed Aug 28 13:16:33 2019 +0800

    Allow disabling HTTP/2 priority frames limit
    
    (cherry picked from commit f2ebbcee400c3c91aa789382d7f7243797ed733c)
---
 doc/admin-guide/files/records.config.en.rst |  4 +++-
 proxy/http2/Http2ConnectionState.cc         | 11 ++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst 
b/doc/admin-guide/files/records.config.en.rst
index 9f3cb66..e4d94c6 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -3660,7 +3660,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:
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 780291a..ddf39ed 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -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",
@@ -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());
 

Reply via email to