This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new 268c3da29d Normalize Accept-Encoding header value before cache lookup
(#11596)
268c3da29d is described below
commit 268c3da29d8086df01a640b59679204d3ea3f2f8
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Tue Jul 23 14:01:42 2024 -0600
Normalize Accept-Encoding header value before cache lookup (#11596)
Co-authored-by: Min Chen <[email protected]>
---
proxy/http/HttpSM.cc | 6 +-
proxy/http/HttpTransact.h | 2 +
.../headers/normalized_ae_match_vary_cache.test.py | 67 ++
.../normalized_ae_varied_transactions.replay.yaml | 813 +++++++++++++++++++++
4 files changed, 886 insertions(+), 2 deletions(-)
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 750531f872..f9b1c1f926 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4864,8 +4864,10 @@ HttpSM::do_cache_lookup_and_read()
HttpCacheKey key;
Cache::generate_key(&key, c_url, t_state.txn_conf->cache_generation_number);
+ t_state.hdr_info.cache_request.copy(&t_state.hdr_info.client_request);
+ HttpTransactHeaders::normalize_accept_encoding(t_state.txn_conf,
&t_state.hdr_info.cache_request);
Action *cache_action_handle = cache_sm.open_read(
- &key, c_url, &t_state.hdr_info.client_request, t_state.txn_conf,
+ &key, c_url, &t_state.hdr_info.cache_request, t_state.txn_conf,
static_cast<time_t>((t_state.cache_control.pin_in_cache_for < 0) ? 0 :
t_state.cache_control.pin_in_cache_for));
//
// pin_in_cache value is an open_write parameter.
@@ -4979,7 +4981,7 @@ HttpSM::do_cache_prepare_action(HttpCacheSM *c_sm,
CacheHTTPInfo *object_read_in
Cache::generate_key(&key, s_url, t_state.txn_conf->cache_generation_number);
Action *cache_action_handle =
- c_sm->open_write(&key, s_url, &t_state.hdr_info.client_request,
object_read_info,
+ c_sm->open_write(&key, s_url, &t_state.hdr_info.cache_request,
object_read_info,
static_cast<time_t>((t_state.cache_control.pin_in_cache_for < 0) ? 0 :
t_state.cache_control.pin_in_cache_for),
retry, allow_multiple);
if (cache_action_handle != ACTION_RESULT_DONE) {
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index 2ec1e45af6..64e2cc58cd 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -634,6 +634,7 @@ public:
HTTPHdr server_request;
HTTPHdr server_response;
HTTPHdr transform_response;
+ HTTPHdr cache_request;
HTTPHdr cache_response;
int64_t request_content_length = HTTP_UNDEFINED_CL;
int64_t response_content_length = HTTP_UNDEFINED_CL;
@@ -867,6 +868,7 @@ public:
hdr_info.server_request.destroy();
hdr_info.server_response.destroy();
hdr_info.transform_response.destroy();
+ hdr_info.cache_request.destroy();
hdr_info.cache_response.destroy();
cache_info.lookup_url_storage.destroy();
cache_info.parent_selection_url_storage.destroy();
diff --git a/tests/gold_tests/headers/normalized_ae_match_vary_cache.test.py
b/tests/gold_tests/headers/normalized_ae_match_vary_cache.test.py
new file mode 100644
index 0000000000..991d2fda32
--- /dev/null
+++ b/tests/gold_tests/headers/normalized_ae_match_vary_cache.test.py
@@ -0,0 +1,67 @@
+'''
+Test cache matching with the normalized Accept-Encoding header field
+and the Vary header field in response
+'''
+# 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 os
+
+Test.Summary = '''
+Test cache matching with the normalized Accept-Encoding and the Vary header
field in response
+'''
+
+Test.ContinueOnFail = True
+
+testName = "NORMALIZE_AE_MATCH_VARY"
+
+replay_file = "replays/normalized_ae_varied_transactions.replay.yaml"
+server = Test.MakeVerifierServerProcess("server", replay_file)
+
+ts = Test.MakeATSProcess("ts", enable_cache=True)
+ts.Disk.remap_config.AddLine(
+ f"map http://www.ae-0.com http://127.0.0.1:{server.Variables.http_port}" +
+ ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=0')
+ts.Disk.remap_config.AddLine(
+ f"map http://www.ae-1.com http://127.0.0.1:{server.Variables.http_port}" +
+ ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=1')
+ts.Disk.remap_config.AddLine(
+ f"map http://www.ae-2.com http://127.0.0.1:{server.Variables.http_port}" +
+ ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=2')
+# disable normalize_ae=3 on 9.1
+ts.Disk.remap_config.AddLine(
+ f"map http://www.ae-3.com http://127.0.0.1:{server.Variables.http_port}" +
+ ' @plugin=conf_remap.so @pparam=proxy.config.http.normalize_ae=3')
+ts.Disk.plugin_config.AddLine('xdebug.so --enable=x-cache')
+ts.Disk.records_config.update(
+ {
+ 'proxy.config.diags.debug.enabled': 1,
+ 'proxy.config.diags.debug.tags': 'http',
+ 'proxy.config.http.response_via_str': 3,
+ # the following variables could affect the results of alternate cache
matching,
+ # define them with their default values explicitly
+ 'proxy.config.cache.limits.http.max_alts': 5,
+ 'proxy.config.http.cache.ignore_accept_mismatch': 2,
+ 'proxy.config.http.cache.ignore_accept_language_mismatch': 2,
+ 'proxy.config.http.cache.ignore_accept_encoding_mismatch': 2,
+ 'proxy.config.http.cache.ignore_accept_charset_mismatch': 2,
+ })
+
+tr = Test.AddTestRun()
+tr.Processes.Default.StartBefore(server)
+tr.Processes.Default.StartBefore(ts)
+tr.AddVerifierClientProcess("client", replay_file,
http_ports=[ts.Variables.port])
+tr.StillRunningAfter = ts
diff --git
a/tests/gold_tests/headers/replays/normalized_ae_varied_transactions.replay.yaml
b/tests/gold_tests/headers/replays/normalized_ae_varied_transactions.replay.yaml
new file mode 100644
index 0000000000..57842341a5
--- /dev/null
+++
b/tests/gold_tests/headers/replays/normalized_ae_varied_transactions.replay.yaml
@@ -0,0 +1,813 @@
+# 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:
+
+ - 404_response: &404_response
+ status: 404
+ reason: "Not Found"
+ headers:
+ fields:
+ - [ Content-Length, 0 ]
+
+sessions:
+- transactions:
+
+ # Case 1 proxy.config.http.normalize_ae:0
+ # load an alternate of no Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case1
+ headers:
+ fields:
+ - [ Host, www.ae-0.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 01 ]
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, No-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "no Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # load an alternate of empty Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case1
+ headers:
+ fields:
+ - [ Host, www.ae-0.com ]
+ - [ X-Debug, x-cache]
+ - [ Accept-Encoding, "" ]
+ - [ uuid, 02 ]
+ delay: 100ms
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, Empty-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "Empty Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Empty-Accept-Encoding, as: equal }
]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # Accept-Encoding header deflate would match the alternate of empty
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case1
+ headers:
+ fields:
+ - [ Host, www.ae-0.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 03 ]
+ - [ Accept-Encoding, deflate ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Empty-Accept-Encoding, as: equal }
]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Accept-Encoding header br, compress would match the alternate of empty
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case1
+ headers:
+ fields:
+ - [ Host, www.ae-0.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 04 ]
+ - [ Accept-Encoding, "br, compress" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Empty-Accept-Encoding, as: equal }
]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # load an alternate of gzip Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case1
+ headers:
+ fields:
+ - [ Host, www.ae-0.com ]
+ - [ X-Debug, x-cache]
+ - [ Accept-Encoding, gzip;q=0.8 ]
+ - [ uuid, 05 ]
+ delay: 100ms
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, Gzip-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "Gzip Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # Accept-Encoding header br, compress, gzip would match the alternate of
gzip Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case1
+ headers:
+ fields:
+ - [ Host, www.ae-0.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 06 ]
+ - [ Accept-Encoding, "br, compress, gzip" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+
+ # Case 2 proxy.config.http.normalize_ae:1
+ # load an alternate of no Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case2
+ headers:
+ fields:
+ - [ Host, www.ae-1.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 11 ]
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, No-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "no Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # empty Accept-Encoding header would match the alternate of no
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case2
+ headers:
+ fields:
+ - [ Host, www.ae-1.com ]
+ - [ X-Debug, x-cache]
+ - [ Accept-Encoding, "" ]
+ - [ uuid, 12 ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Accept-Encoding header deflate would match the alternate of no
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case2
+ headers:
+ fields:
+ - [ Host, www.ae-1.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 13 ]
+ - [ Accept-Encoding, deflate ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Accept-Encoding header br, compress would match the alternate of no
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case2
+ headers:
+ fields:
+ - [ Host, www.ae-1.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 14 ]
+ - [ Accept-Encoding, "br, compress" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # load an alternate of gzip Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case2
+ headers:
+ fields:
+ - [ Host, www.ae-1.com ]
+ - [ X-Debug, x-cache]
+ - [ Accept-Encoding, gzip;q=0.8 ]
+ - [ uuid, 15 ]
+ delay: 100ms
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, Gzip-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "Gzip Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # Accept-Encoding header br, compress, gzip would match the alternate of
gzip Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case2
+ headers:
+ fields:
+ - [ Host, www.ae-1.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 16 ]
+ - [ Accept-Encoding, "br, compress, gzip" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Case 3 proxy.config.http.normalize_ae:2
+ # load an alternate of no Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case3
+ headers:
+ fields:
+ - [ Host, www.ae-2.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 21 ]
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, No-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "no Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # empty Accept-Encoding header would match the alternate of no
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case3
+ headers:
+ fields:
+ - [ Host, www.ae-2.com ]
+ - [ X-Debug, x-cache]
+ - [ Accept-Encoding, "" ]
+ - [ uuid, 22 ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Accept-Encoding header deflate would match the alternate of no
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case3
+ headers:
+ fields:
+ - [ Host, www.ae-2.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 23 ]
+ - [ Accept-Encoding, deflate ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # load an alternate of br Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case3
+ headers:
+ fields:
+ - [ Host, www.ae-2.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 24 ]
+ - [ Accept-Encoding, "br, compress" ]
+ delay: 100ms
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, Br-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "br Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Br-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # load an alternate of gzip Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case3
+ headers:
+ fields:
+ - [ Host, www.ae-2.com ]
+ - [ X-Debug, x-cache]
+ - [ Accept-Encoding, gzip;q=0.8 ]
+ - [ uuid, 25 ]
+ delay: 100ms
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, Gzip-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "Gzip Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # Accept-Encoding header br, compress, gzip would match the alternate of br
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case3
+ headers:
+ fields:
+ - [ Host, www.ae-2.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 26 ]
+ - [ Accept-Encoding, "br, compress, gzip" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Br-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Accept-Encoding header compress, gzip would match the alternate of gzip
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case3
+ headers:
+ fields:
+ - [ Host, www.ae-2.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 27 ]
+ - [ Accept-Encoding, "compress, gzip" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Case 4 proxy.config.http.normalize_ae:3
+ # load an alternate of no Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 31 ]
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, No-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "no Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # empty Accept-Encoding header would match the alternate of no
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ Accept-Encoding, "" ]
+ - [ uuid, 32 ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Accept-Encoding header deflate would match the alternate of no
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 33 ]
+ - [ Accept-Encoding, deflate ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: No-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # load an alternate of br Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 34 ]
+ - [ Accept-Encoding, "br, compress" ]
+ delay: 100ms
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, Br-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "br Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Br-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # load an alternate of gzip Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ Accept-Encoding, gzip;q=0.8 ]
+ - [ uuid, 35 ]
+ delay: 100ms
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, Gzip-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "Gzip Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: miss, as: equal } ]
+
+ # NOTICE: This case should load an alternate of br, gzip Accept-Encoding
header.
+ # However, due to the implementation of calculate_quality_of_match(),
+ # ATS matches the alternate of gzip Accept-Encoding header.
+ # The result is DIFFERENT from the description of
proxy.config.http.normalize_ae: 3
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 36 ]
+ - [ Accept-Encoding, "br, compress, gzip" ]
+ delay: 100ms
+
+ server-response:
+ status: 200
+ reason: OK
+ headers:
+ fields:
+ - [ Transfer-Encoding, chunked ]
+ - [ Cache-Control, max-age=300 ]
+ - [ Vary, Accept-Encoding ]
+ - [ Connection, close ]
+ - [ X-Response-Identifier, Br-Gzip-Accept-Encoding ]
+ content:
+ encoding: plain
+ data: "Br, Gzip Accept-Encoding"
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ # - [ X-Response-Identifier, { value: Br-Gzip-Accept-Encoding, as:
equal } ]
+ # - [ X-Cache, { value: miss, as: equal } ]
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Accept-Encoding header compress, gzip would match the alternate of gzip
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 37 ]
+ - [ Accept-Encoding, "compress, gzip" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # Accept-Encoding header br;q=1.1 would match the alternate of br
Accept-Encoding header
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 38 ]
+ - [ Accept-Encoding, "br;q=1.1" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ - [ X-Response-Identifier, { value: Br-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]
+
+ # NOTICE: This case should make Accept-Encoding header br, gzip;q=0.8 match
+ # the alternate of br, gzip Accept-Encoding header.
+ # However, due to the implementation of calculate_quality_of_match(),
+ # ATS matches the alternate of gzip Accept-Encoding header.
+ # The result is DIFFERENT from the description of
proxy.config.http.normalize_ae: 3
+ - client-request:
+ method: "GET"
+ version: "1.1"
+ url: /case4
+ headers:
+ fields:
+ - [ Host, www.ae-3.com ]
+ - [ X-Debug, x-cache]
+ - [ uuid, 39 ]
+ - [ Accept-Encoding, "br, gzip;q=0.8" ]
+ delay: 100ms
+
+ server-response:
+ <<: *404_response
+
+ proxy-response:
+ status: 200
+ headers:
+ fields:
+ # - [ X-Response-Identifier, { value: Br-Gzip-Accept-Encoding, as:
equal } ]
+ - [ X-Response-Identifier, { value: Gzip-Accept-Encoding, as: equal } ]
+ - [ X-Cache, { value: hit-fresh, as: equal } ]