This is an automated email from the ASF dual-hosted git repository.
zwoop 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 6610af0ae s3_auth: Fix parsing of virtual_host (#9103)
6610af0ae is described below
commit 6610af0ae726abfa4c2536395dc43247ec9d1383
Author: Mo Chen <[email protected]>
AuthorDate: Fri Sep 30 13:41:24 2022 -0500
s3_auth: Fix parsing of virtual_host (#9103)
A recent change broke parsing for the config key virtual_host which can
be supplied without a value. This change fixes parsing for
virtual_host, and adds it to autest.
(cherry picked from commit d35a7798f04d7d0a3944c71eca5d819d2ac15ac3)
---
plugins/s3_auth/s3_auth.cc | 2 +-
tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing_ts.gold | 2 +-
tests/gold_tests/pluginTest/s3_auth/rules/v4-parse-test.test_input | 5 +++++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/plugins/s3_auth/s3_auth.cc b/plugins/s3_auth/s3_auth.cc
index e9ac6c53c..352b44ce0 100644
--- a/plugins/s3_auth/s3_auth.cc
+++ b/plugins/s3_auth/s3_auth.cc
@@ -545,7 +545,7 @@ S3Config::parse_config(const std::string &config_fname)
}
// Identify the keys (and values if appropriate)
- std::string key_str{key_val.split_prefix_at('=').trim_if(&isspace)};
+ std::string key_str{key_val.take_prefix_at('=').trim_if(&isspace)};
std::string val_str{key_val.trim_if(&isspace)};
if (key_str == "secret_key") {
diff --git a/tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing_ts.gold
b/tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing_ts.gold
index d266d6a69..a61f541ff 100644
--- a/tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing_ts.gold
+++ b/tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing_ts.gold
@@ -1,4 +1,4 @@
-``DIAG: (s3_auth) New rule: access_key=1234567, virtual_host=no, version=4
+``DIAG: (s3_auth) New rule: access_key=1234567, virtual_host=yes, version=4
``DIAG: (s3_auth) Set the header x-amz-content-sha256: UNSIGNED-PAYLOAD
``DIAG: (s3_auth) Set the header x-amz-date: ``
``DIAG: (s3_auth) Set the header x-amz-security-token:
hkMsi6/bfHyBKrSeM/H0hoXeyx8z1yZ/mJ0c+B/TqYx=tTJDjnQWtul38Z9iVJjeH1HB4VT2c=2o3yE3o=I9kmFs/lJDR85qWjB8e5asY/WbjyRpbAzmDipQpboIcYnUYg55bxrQFidV/q8gZa5A9MpR3n=op1C0lWjeBqcEJxpevNZxteSQTQfeGsi98Cdf+On=/SINVlKrNhMnmMsDOLMGx1YYt9d4UsRg1jtVrwxL4Vd/F7aHCZySAXKv+1rkhACR023wpa3dhp+xirGJxSO9LWwvcrTdM4xJo4RS8B40tGENOJ1NKixUJxwN/6og58Oft/u==uleR89Ja=7zszK2H7tX3DqmEYNvNDYQh/7VBRe5otghQtPwJzWpXAGk+Vme4hPPM5K6axH2LxipXzRiIV=oxNs0upKNu1FvuzbCQmkQdKQVm
[...]
diff --git a/tests/gold_tests/pluginTest/s3_auth/rules/v4-parse-test.test_input
b/tests/gold_tests/pluginTest/s3_auth/rules/v4-parse-test.test_input
index 3b963c485..825d53501 100644
--- a/tests/gold_tests/pluginTest/s3_auth/rules/v4-parse-test.test_input
+++ b/tests/gold_tests/pluginTest/s3_auth/rules/v4-parse-test.test_input
@@ -27,3 +27,8 @@ secret_key = 9999999
session_token=hkMsi6/bfHyBKrSeM/H0hoXeyx8z1yZ/mJ0c+B/TqYx=tTJDjnQWtul38Z9iVJjeH1HB4VT2c=2o3yE3o=I9kmFs/lJDR85qWjB8e5asY/WbjyRpbAzmDipQpboIcYnUYg55bxrQFidV/q8gZa5A9MpR3n=op1C0lWjeBqcEJxpevNZxteSQTQfeGsi98Cdf+On=/SINVlKrNhMnmMsDOLMGx1YYt9d4UsRg1jtVrwxL4Vd/F7aHCZySAXKv+1rkhACR023wpa3dhp+xirGJxSO9LWwvcrTdM4xJo4RS8B40tGENOJ1NKixUJxwN/6og58Oft/u==uleR89Ja=7zszK2H7tX3DqmEYNvNDYQh/7VBRe5otghQtPwJzWpXAGk+Vme4hPPM5K6axH2LxipXzRiIV=oxNs0upKNu1FvuzbCQmkQdKQVmXl0344vngngrgN7wkEfrYtmKwICmpAS0cbW9jdSCl
[...]
version=4
+
+# Test a key without value
+virtual_host
+
+