diff options
author | Luca Casonato <hello@lcas.dev> | 2022-08-23 12:43:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 12:43:04 +0200 |
commit | 24f7f3fda984e7226b5858085a7ed1c53ab081e0 (patch) | |
tree | c72348b71d68ea200644e8a07806d1ba9888a8a6 /ext/fetch/lib.rs | |
parent | ecf3b51fd93c36f10e7ce53e961bdeca449a955f (diff) |
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.
Diffstat (limited to 'ext/fetch/lib.rs')
-rw-r--r-- | ext/fetch/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
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); } } |