ezelkow1 commented on code in PR #13776: URL: https://github.com/apache/trafficserver/pull/13776#discussion_r4160267409
########## 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: Good call. Adding the stale-revalidation case turned up a real gap: after the origin's 304, the cache merged the origin's strong ETag back over the weakened one on the compressed copy. Fixed in the plugin's READ_RESPONSE_HDR handler (the 304's ETag is weakened when it matches the cached copy's weak ETag), and the test now covers fill → stale revalidation → follow-up cache hit. Note that ATS strips W/ when conditionalizing a revalidation (HttpTransact.cc), so the upstream request carries If-None-Match: "rev1" rather than W/"rev1", and the test asserts that. -- 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]
