From 24f7f3fda984e7226b5858085a7ed1c53ab081e0 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Tue, 23 Aug 2022 12:43:04 +0200 Subject: fix(ext/fetch): ignore user content-length header (#15555) Previously if a user specified a content-length header for an POST request without a body, the request would contain two `content-length` headers. One added by us, and one added by the user. This commit ignores all content-length headers coming from the user, because we need to have the sole authority on the content-length because we transmit the body. --- ext/fetch/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs index 232e6964e..20db7abbc 100644 --- a/ext/fetch/lib.rs +++ b/ext/fetch/lib.rs @@ -287,7 +287,7 @@ where .map_err(|err| type_error(err.to_string()))?; let v = HeaderValue::from_bytes(&value) .map_err(|err| type_error(err.to_string()))?; - if name != HOST { + if !matches!(name, HOST | CONTENT_LENGTH) { request = request.header(name, v); } } -- cgit v1.2.3