From a52b15e9c0655f87c2b98ab7236df926d4749e2c Mon Sep 17 00:00:00 2001 From: neuronull Date: Thu, 13 Apr 2023 13:15:24 -0600 Subject: [PATCH 1/3] add unit test, ignored --- lib/vector-core/src/config/proxy.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/vector-core/src/config/proxy.rs b/lib/vector-core/src/config/proxy.rs index 79bceaa63c79c..0cddf9e0f41ff 100644 --- a/lib/vector-core/src/config/proxy.rs +++ b/lib/vector-core/src/config/proxy.rs @@ -356,4 +356,26 @@ mod tests { expected_header_value.as_ref().ok() ); } + + #[ignore] + #[test] + fn build_proxy_with_special_chars_url_encoded() { + let config = ProxyConfig { + http: Some("http://user:P%40ssw0rd@1.2.3.4:5678".into()), + https: Some("https://user:P%40ssw0rd@2.3.4.5:9876".into()), + ..Default::default() + }; + let first = config + .http_proxy() + .expect("should not be an error") + .expect("should not be None"); + let encoded_header = format!("Basic {}", BASE64_STANDARD.encode("user:P@ssw0rd")); + let expected_header_value = HeaderValue::from_str(encoded_header.as_str()); + + assert_eq!( + first.headers().get("authorization"), + expected_header_value.as_ref().ok() + ); + } + } From 0129da5cdf518de99d7b6923d72ae0cdc48fb0f8 Mon Sep 17 00:00:00 2001 From: neuronull Date: Thu, 13 Apr 2023 14:11:04 -0600 Subject: [PATCH 2/3] add spell checking pattern --- .github/actions/spelling/patterns.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt index 8050ff07afd4f..c15a1bb00a89f 100644 --- a/.github/actions/spelling/patterns.txt +++ b/.github/actions/spelling/patterns.txt @@ -218,3 +218,6 @@ k8s # ignore comment in package-msi.sh [#].*custom\.a28ecdc.* + +# ignore specific user:password string containing special chars for unit testing +user:P@ssw0rd From 4a862d14f1d8354291f9c40f067e6483e46cd9f3 Mon Sep 17 00:00:00 2001 From: neuronull Date: Thu, 13 Apr 2023 14:36:27 -0600 Subject: [PATCH 3/3] clippy --- lib/vector-core/src/config/proxy.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/vector-core/src/config/proxy.rs b/lib/vector-core/src/config/proxy.rs index 0cddf9e0f41ff..266ffed72d167 100644 --- a/lib/vector-core/src/config/proxy.rs +++ b/lib/vector-core/src/config/proxy.rs @@ -377,5 +377,4 @@ mod tests { expected_header_value.as_ref().ok() ); } - }