Copilot commented on code in PR #3524:
URL: https://github.com/apache/brpc/pull/3524#discussion_r3943315034


##########
src/brpc/policy/http2_rpc_protocol.cpp:
##########
@@ -1414,6 +1418,12 @@ int 
H2StreamContext::ConsumeHeaders(butil::IOBufBytesIterator& it) {
             h.set_content_type(pair.value);
         } else {
             h.AppendHeader(pair.name, pair.value);
+            if (FLAGS_http_max_header_count > 0 &&
+                h.HeaderCount() > FLAGS_http_max_header_count) {
+                LOG(ERROR) << "Too many headers, max="
+                           << FLAGS_http_max_header_count;
+                return -1;

Review Comment:
   Returning -1 for a per-stream limit violation (too many headers / too many 
queries in :path) is currently treated as a generic header parse failure by 
OnHeaders/OnContinuation, which results in a connection-level GOAWAY 
(stream_id=0) rather than a stream-level RST_STREAM. That makes one oversized 
request tear down the entire HTTP/2 connection and can impact unrelated 
concurrent streams; consider mapping these limit violations to a stream error 
(e.g. H2_ENHANCE_YOUR_CALM with stream_id()) so only the offending stream is 
reset.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to