Closed
Bug 1508699
Opened 6 years ago
Closed 5 years ago
Fetch() should not store lowercase header names
Categories
(Core :: DOM: Core & HTML, defect, P2)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla66
People
(Reporter: baku, Assigned: baku)
Details
Attachments
(1 file, 1 obsolete file)
12.78 KB,
patch
|
asuth
:
review+
|
Details | Diff | Splinter Review |
We currently "lowercase" header names. This is not written in the spec and it makes several WPTs to fail. We also don't merge headers. I'll fix this in the same patch.
Assignee | ||
Comment 1•6 years ago
|
||
"A header list list contains a name name if list contains a header whose name is a byte-case-insensitive match for name. "
Attachment #9026433 -
Flags: review?(bugmail)
Assignee | ||
Comment 2•6 years ago
|
||
Attachment #9026433 -
Attachment is obsolete: true
Attachment #9026433 -
Flags: review?(bugmail)
Attachment #9026441 -
Flags: review?(bugmail)
Updated•6 years ago
|
Priority: -- → P2
Comment 4•5 years ago
|
||
Comment on attachment 9026441 [details] [diff] [review] name.patch Review of attachment 9026441 [details] [diff] [review]: ----------------------------------------------------------------- restating: - Some nsACString types are converted to nsCString because .get() is used and nsCString guarantees zero-termination but nsACString is dumb and does not. - Capitalization is ignored throughout the logic except... - The first capitalization seen for a (case-insensitive) header name is latched so that if we see "foo" then "fOO" then "Foo", "foo" will win. ::: dom/fetch/FetchDriver.cpp @@ +1450,5 @@ > FetchDriver::SetRequestHeaders(nsIHttpChannel* aChannel) const > { > MOZ_ASSERT(aChannel); > > + // nsIHttpChannel has a set of pre-configured headers (Accept, Thanks for this very helpful comment! ::: dom/fetch/InternalHeaders.cpp @@ +524,5 @@ > } > > if (!found) { > + Entry newEntry = entry; > + ToLowerCase(newEntry.mName); Restating: The "sort and combine" algorithm at https://fetch.spec.whatwg.org/#concept-header-list-sort-and-combine calls for the headers to be byte-lowercased. Previously, this was handled by everything being lowercased, but since the names are no longer normalized to be lowercased elsewhere in the class, the normalization needs to happen here. ::: dom/fetch/InternalHeaders.h @@ +160,5 @@ > IsForbiddenRequestNoCorsHeader(aName, aValue) || > IsForbiddenResponseHeader(aName); > } > > + void ReuseExistingNameIfExists(nsCString& aName) const; Please add a comment explaining the intent of this method. Something like: This method updates the passed name to match the capitalization of a header with the same name (ignoring case, per the spec).
Attachment #9026441 -
Flags: review?(bugmail) → review+
Pushed by amarchesini@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/0edf62695f1d Fetch() should not send lowercase header names, r=asuth
Comment 6•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/0edf62695f1d
Status: NEW → RESOLVED
Closed: 5 years ago
status-firefox66:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
Updated•5 years ago
|
Flags: needinfo?(bugmail) → in-testsuite+
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
Updated•5 years ago
|
Type: enhancement → defect
You need to log in
before you can comment on or make changes to this bug.
Description
•