maskit commented on code in PR #12673:
URL: https://github.com/apache/trafficserver/pull/12673#discussion_r2577906698


##########
src/proxy/http2/Http2ConnectionState.cc:
##########
@@ -345,14 +345,23 @@ 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.
+        // Per RFC 9113, we must decode the header block even when refusing 
the stream to keep
+        // the HPACK dynamic table in sync. Create a temporary unregistered 
stream for decoding.
         if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) {
-          return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
-                            error.msg);
+          uint32_t const initial_local_stream_window = 
this->acknowledged_local_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE);
+          stream = THREAD_ALLOC_INIT(http2StreamAllocator, this_ethread(), 
this->session->get_proxy_session(), stream_id,
+                                     
this->peer_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE), 
initial_local_stream_window,
+                                     !STREAM_IS_REGISTERED);
+          if (!stream) {
+            // Failed to create even a temporary stream, this is a serious 
error.
+            return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_INTERNAL_ERROR,
+                              "failed to create temporary stream for header 
decoding");
+          }
+          free_stream_after_decoding  = true;
+          reset_header_after_decoding = true;

Review Comment:
   Why don't you delete the stream here and return `error` that probably 
contains `HTTP2_ERROR_REFUSED_STREAM`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to