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


##########
tests/gold_tests/pluginTest/compress/compress_100_continue_client.py:
##########
@@ -0,0 +1,129 @@
+#!/usr/bin/env python3
+"""Client that sends a POST with Expect: 100-continue through ATS.
+
+Used to reproduce the crash in HttpTunnel::producer_run when compress.so
+with cache=true is combined with a 100 Continue response from the origin.

Review Comment:
   Docstring says the crash is reproduced with `compress.so` configured with 
`cache=true`, but the test config used here sets `cache false` (which 
corresponds to untransformed caching in compress). Please update the docstring 
to match the actual configuration/behavior to avoid confusion when maintaining 
the test.
   ```suggestion
   with cache=false (untransformed caching) is combined with a 100 Continue 
response from the origin.
   ```



##########
tests/gold_tests/pluginTest/compress/compress-cache-untransformed.test.py:
##########
@@ -0,0 +1,112 @@
+'''
+Regression test for https://github.com/apache/trafficserver/issues/12244
+
+The crash requires two conditions in the same transaction:
+1. An intermediate response (100 Continue) is forwarded to the client, which
+   sets client_response_hdr_bytes to the intermediate header size via
+   setup_100_continue_transfer().
+2. The final response goes through a compress transform with untransformed
+   cache writing (cache=true), which calls 
setup_server_transfer_to_transform().
+   For non-chunked responses, client_response_hdr_bytes is NOT reset to 0.
+
+perform_cache_write_action() then passes the stale client_response_hdr_bytes
+as skip_bytes to the cache-write consumer, but the server-to-transform tunnel
+buffer contains only body data (no headers). The assertion in
+HttpTunnel::producer_run fires:
+
+  c->skip_bytes <= c->buffer_reader->read_avail()
+
+This test uses a custom origin that sends "100 Continue" followed by a
+compressible, non-chunked 200 OK to trigger the exact crash path.
+'''
+#  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.
+
+import sys
+
+from ports import get_port
+
+Test.Summary = '''
+Regression test for compress plugin with cache=true causing assertion failure
+when origin sends 100 Continue before a compressible response (#12244)

Review Comment:
   `Test.Summary` mentions "cache=true" causing the assertion failure, but the 
config used in this test sets `cache false` (untransformed caching in 
compress). Please update the summary string to accurately reflect the 
configuration under test.
   ```suggestion
   Regression test for compress plugin with untransformed caching (cache=false)
   causing assertion failure when origin sends 100 Continue before a 
compressible
   response (#12244)
   ```



##########
tests/gold_tests/pluginTest/compress/compress-cache-untransformed.test.py:
##########
@@ -0,0 +1,112 @@
+'''
+Regression test for https://github.com/apache/trafficserver/issues/12244
+
+The crash requires two conditions in the same transaction:
+1. An intermediate response (100 Continue) is forwarded to the client, which
+   sets client_response_hdr_bytes to the intermediate header size via
+   setup_100_continue_transfer().
+2. The final response goes through a compress transform with untransformed
+   cache writing (cache=true), which calls 
setup_server_transfer_to_transform().
+   For non-chunked responses, client_response_hdr_bytes is NOT reset to 0.
+

Review Comment:
   This test description repeatedly refers to `compress` running with 
`cache=true`, but the config file used (`cache-true-untransformed.config`) 
currently sets `cache false` (untransformed caching). Please update the wording 
(and ideally the config filename) so the test documents the actual condition 
needed to hit the crash path.



##########
tests/gold_tests/pluginTest/compress/compress_100_continue_origin.py:
##########
@@ -0,0 +1,127 @@
+#!/usr/bin/env python3
+"""Origin server that sends 100 Continue then a compressible 200 OK.
+
+Used to reproduce the crash in HttpTunnel::producer_run when compress.so
+with cache=true is combined with a 100 Continue response from the origin.

Review Comment:
   Docstring says the crash is reproduced with `compress.so` configured with 
`cache=true`, but the test config used here sets `cache false` (which 
corresponds to untransformed caching in compress). Please update the docstring 
to match the actual configuration/behavior to avoid confusion when maintaining 
the test.
   ```suggestion
   with cache=false (untransformed caching) is combined with a 100 Continue
   response from the origin.
   ```



##########
tests/gold_tests/pluginTest/compress/etc/cache-true-untransformed.config:
##########
@@ -0,0 +1,5 @@
+cache false

Review Comment:
   The config filename and surrounding test/docs say "cache=true", but this 
file sets `cache false`. In the compress plugin, `cache true` enables caching 
the transformed response and disables untransformed caching; `cache false` does 
the opposite. Please align the filename (and any references) with the actual 
setting, or flip the setting if the intent really is transformed caching.
   ```suggestion
   cache true
   ```



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