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

masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 14d5b2ce40 Terminate H2 connection by COMPRESSION_ERROR (#11222)
14d5b2ce40 is described below

commit 14d5b2ce401446a13b2fef4ab8dbc7cf890acf25
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Apr 12 08:16:09 2024 +0900

    Terminate H2 connection by COMPRESSION_ERROR (#11222)
---
 src/proxy/http2/Http2ConnectionState.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index 9bb38b097a..c15102e3c5 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -320,6 +320,13 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
&frame)
       stream     = this->create_stream(stream_id, error);
       new_stream = true;
       if (!stream) {
+        // Terminate the connection with COMPRESSION_ERROR because we don't 
decompress the field block in this HEADERS frame.
+        // TODO: try to decompress to keep HPACK Dynamic Table in sync.
+        if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) {
+          return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
+                            error.msg);
+        }
+
         return error;
       }
     }
@@ -377,7 +384,7 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
&frame)
     }
     // Protocol error if the stream depends on itself
     if (stream_id == params.priority.stream_dependency) {
-      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+      return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
                         "recv headers self dependency");
     }
 

Reply via email to