From 6d0607e9bbdd86bfc4781c68dc9cf29b47e6e1cf Mon Sep 17 00:00:00 2001 From: amrbashir Date: Tue, 29 Oct 2024 21:31:40 +0300 Subject: [PATCH 1/2] chore: print a warning in development for forbidden headers closes #1979 --- plugins/http/src/commands.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/http/src/commands.rs b/plugins/http/src/commands.rs index 39a68973ac..cc84b847b1 100644 --- a/plugins/http/src/commands.rs +++ b/plugins/http/src/commands.rs @@ -191,6 +191,11 @@ pub async fn fetch( let name = HeaderName::from_str(&h)?; #[cfg(not(feature = "unsafe-headers"))] if is_unsafe_header(&name) { + #[cfg(debug_assertions)] + { + eprintln!("[\x1b[33mWARNING\x1b[0m] Skipping {name} header as it is a forbidden header per fetch spec https://fetch.spec.whatwg.org/#terminology-headers"); + eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `unsafe-headers` feature flag in your Cargo.toml"); + } continue; } From 431bf103fb665013b4b201fa331a77a16ef48020 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Wed, 30 Oct 2024 13:47:58 +0300 Subject: [PATCH 2/2] Update plugins/http/src/commands.rs --- plugins/http/src/commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/http/src/commands.rs b/plugins/http/src/commands.rs index cc84b847b1..f4bc3aabc1 100644 --- a/plugins/http/src/commands.rs +++ b/plugins/http/src/commands.rs @@ -194,7 +194,7 @@ pub async fn fetch( #[cfg(debug_assertions)] { eprintln!("[\x1b[33mWARNING\x1b[0m] Skipping {name} header as it is a forbidden header per fetch spec https://fetch.spec.whatwg.org/#terminology-headers"); - eprintln!("[\x1b[33mWARNING\x1b[0m] if this is a desired behavior, you can enable `unsafe-headers` feature flag in your Cargo.toml"); + eprintln!("[\x1b[33mWARNING\x1b[0m] if keeping the header is a desired behavior, you can enable `unsafe-headers` feature flag in your Cargo.toml"); } continue; }