From ce297f219c2f43d0237bdaf11228caf65a2d1f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Sat, 28 Oct 2023 23:09:37 +0200 Subject: [PATCH] fix(cli): Correctly parse http headers from cmd line --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5b99938..1626714 100644 --- a/src/main.rs +++ b/src/main.rs @@ -342,7 +342,7 @@ fn parse_sni_override(arg: &str) -> Result { } } -fn parse_http_headers(arg: &str) -> Result<(String, HeaderValue), io::Error> { +fn parse_http_headers(arg: &str) -> Result<(HeaderName, HeaderValue), io::Error> { let Some((key, value)) = arg.split_once(':') else { return Err(io::Error::new( ErrorKind::InvalidInput, @@ -363,7 +363,7 @@ fn parse_http_headers(arg: &str) -> Result<(String, HeaderValue), io::Error> { } }; - Ok((key.to_owned(), value)) + Ok((HeaderName::from_str(key).unwrap(), value)) } fn parse_http_credentials(arg: &str) -> Result {