Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/spelling/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions lib/vector-core/src/config/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,25 @@ 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()
);
}
}