Copilot commented on code in PR #12748:
URL: https://github.com/apache/trafficserver/pull/12748#discussion_r2621110693


##########
include/proxy/http2/Http2Stream.h:
##########
@@ -390,11 +390,11 @@ inline bool
 Http2Stream::payload_length_is_valid() const
 {
   uint32_t content_length = _receive_header.get_content_length();
-  if (content_length != 0 && content_length != data_length) {
+  if (content_length != 0 && data_length != 0 && content_length != 
data_length) {
     Warning("Bad payload length content_length=%d data_legnth=%d session_id=%" 
PRId64, content_length,
             static_cast<int>(data_length), _proxy_ssn->connection_id());
   }
-  return content_length == 0 || content_length == data_length;
+  return content_length == 0 || data_length == 0 || content_length == 
data_length;

Review Comment:
   This fix for RFC 7540 section 8.1.2.6 compliance (allowing non-zero 
Content-Length with zero-length payloads) lacks test coverage. Consider adding 
an HTTP/2 test case that verifies HEAD responses with Content-Length headers 
are handled correctly, specifically testing that a HEAD response with 
Content-Length greater than 0 but data_length of 0 does not return a 502 error.



-- 
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