mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 815299 - Part 2: Accept empty HTTP headers in fetch; r=jdm
This commit is contained in:
parent
13be7cbd93
commit
86169e290f
@ -477,7 +477,11 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
|
||||
nsAutoTArray<InternalHeaders::Entry, 5> headers;
|
||||
mRequest->Headers()->GetEntries(headers);
|
||||
for (uint32_t i = 0; i < headers.Length(); ++i) {
|
||||
httpChan->SetRequestHeader(headers[i].mName, headers[i].mValue, false /* merge */);
|
||||
if (headers[i].mValue.IsEmpty()) {
|
||||
httpChan->SetEmptyRequestHeader(headers[i].mName);
|
||||
} else {
|
||||
httpChan->SetRequestHeader(headers[i].mName, headers[i].mValue, false /* merge */);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2. Set the referrer.
|
||||
|
@ -320,3 +320,12 @@ fetch(new Request('body-blob', {method: 'POST', body: new Blob(new String('my bo
|
||||
finish();
|
||||
});
|
||||
});
|
||||
|
||||
expectAsyncResult();
|
||||
fetch(new Request('empty-header', {headers:{"emptyheader":""}}))
|
||||
.then(function(res) {
|
||||
return res.text();
|
||||
}).then(function(body) {
|
||||
my_ok(body == "emptyheader", "The empty header was observed in the fetch event");
|
||||
finish();
|
||||
});
|
||||
|
@ -274,4 +274,13 @@ onfetch = function(ev) {
|
||||
else if (ev.request.url.includes('xhr-method-test.txt')) {
|
||||
ev.respondWith(new Response('intercepted ' + ev.request.method));
|
||||
}
|
||||
|
||||
else if (ev.request.url.includes('empty-header')) {
|
||||
if (!ev.request.headers.has("emptyheader") ||
|
||||
ev.request.headers.get("emptyheader") !== "") {
|
||||
ev.respondWith(Promise.reject());
|
||||
return;
|
||||
}
|
||||
ev.respondWith(new Response("emptyheader"));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user