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


##########
src/proxy/http2/Http2ConnectionState.cc:
##########
@@ -149,6 +153,7 @@ Http2ConnectionState::rcv_data_frame(const Http2Frame 
&frame)
   // the recipient MUST respond with a stream error of type STREAM_CLOSED.
   if (stream->get_state() != Http2StreamState::HTTP2_STREAM_STATE_OPEN &&
       stream->get_state() != 
Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL) {
+    this->credit_discarded_data(payload_length);
     return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_STREAM_CLOSED,

Review Comment:
   Discarded DATA is only credited on the closed-stream and state-check 
returns. Several later stream-class returns also drop the payload after the 
connection window was debited, and they never call `credit_discarded_data()`. 
These are the `payload_length_is_valid()` return (about line 181), the 
`stream->get_local_rwnd() < payload_length` return (about line 224), the `no 
writer` return (about line 241), and the `Write mismatch` return (about line 
261). The `change_state()` failure return (about lines 176-179) has the same 
gap. Call `credit_discarded_data(payload_length);` before each of these returns.



##########
tests/uranium_tests/h2/clients/h2_closed_stream_window_drain.py:
##########
@@ -0,0 +1,291 @@
+#!/usr/bin/env python3
+'''
+HTTP/2 client that floods a closed stream with DATA and then verifies the
+connection is still usable.
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.

Review Comment:
   The module docstring sits above the Apache license header. Other Python 
clients in this directory, such as h2_content_length_client.py, use the 
shebang, then the license block, then the docstring. New source and test files 
must start with the license header, so move the license block above the 
docstring.



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