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


##########
tests/gold_tests/pluginTest/compress/replay/compress-etag.replay.yaml:
##########
@@ -0,0 +1,201 @@
+#  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.
+
+meta:
+  version: "1.0"
+
+  blocks:
+  - compressible-body: &compressible-body
+      content:
+        encoding: plain
+        size: 1024
+
+  # Served if a request that should be answered from cache reaches the origin.
+  - unexpected-origin-response: &unexpected-origin-response
+      status: 500
+      reason: Unexpected
+      headers:
+        fields:
+        - [ Content-Length, 0 ]
+
+autest:
+  description: 'Verify compress weakens strong ETags on compressed responses'
+
+  server:
+    name: 'server'
+
+  client:
+    name: 'client'
+
+  ats:
+    name: 'ts'
+
+    copy_to_config_dir:
+      - 'compress-etag.config'
+
+    records_config:
+      proxy.config.diags.debug.enabled: 1
+      proxy.config.diags.debug.tags: 'http|compress'
+
+    remap_config:
+      - from: "http://compress.example/";
+        to: "http://127.0.0.1:{SERVER_HTTP_PORT}/";
+        plugins:
+          - name: 'compress.so'
+            args: ['compress-etag.config']
+
+sessions:
+- transactions:
+
+  #############################################################################
+  # A strong origin ETag becomes weak once the body is compressed: the bytes
+  # no longer match the origin's, but the content is semantically the same.
+  #############################################################################
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      url: /strong
+      headers:
+        fields:
+        - [ Host, compress.example ]
+        - [ Accept-Encoding, gzip ]
+        - [ uuid, strong-compressed ]
+
+    server-response:
+      status: 200
+      reason: OK
+      headers:
+        fields:
+        - [ Content-Type, text/plain ]
+        - [ Cache-Control, "public, max-age=3600" ]

Review Comment:
   `max-age=3600` keeps this object fresh, so the following conditional request 
is answered from cache and never exercises the origin-revalidation failure 
described by this PR. Please add a stale or forced-revalidation transaction 
(with a cache-write delay), assert that the proxy request carries 
`If-None-Match: W/"abc123"`, and have the origin return 304; otherwise a 
regression that still fails to validate the transformed object at the origin 
would pass this test.



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