commit a653050dec040925463d4b14a1f6e43aeaeae101
parent 70b331be80f6d2015956048d23facf55ba0b4d41
Author: valadaptive <valadaptive@protonmail.com>
Date: Wed, 17 Dec 2025 08:53:01 +0000
Bug 1983387 - Don't merge Accept-Encoding: identity. r=necko-reviewers,jesup
The merge flag in HttpBaseChannel::SetRequestHeader corresponds to the
"combine a header" behavior in the fetch spec, in which we add a value
to a comma-separated list of values in the header. The fetch spec does
not tell us to *combine* (`Accept-Encoding`, `identity`), it tells us to
*append* it. We got away with this before because of a sneaky WPT change
that I'm fixing upstream
(https://github.com/web-platform-tests/wpt/pull/54373).
Differential Revision: https://phabricator.services.mozilla.com/D261327
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -1416,8 +1416,8 @@ nsresult nsHttpChannel::Connect() {
// Step 8.18 of HTTP-network-or-cache fetch
// https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
nsAutoCString rangeVal;
- if (NS_SUCCEEDED(mRequestHead.GetHeader(nsHttp::Range, rangeVal))) {
- SetRequestHeader("Accept-Encoding"_ns, "identity"_ns, true);
+ if (NS_SUCCEEDED(GetRequestHeader("Range"_ns, rangeVal))) {
+ SetRequestHeader("Accept-Encoding"_ns, "identity"_ns, false);
}
if (mRequestHead.IsPost() || mRequestHead.IsPatch()) {