image/apng in content-type response header causes HTML content to be incorrectly displayed as APNG Image
Categories
(Core :: DOM: Navigation, defect, P2)
Tracking
()
People
(Reporter: 13hurdw, Unassigned)
References
(Regression, )
Details
(Keywords: regression)
Updated•7 years ago
|
![]() |
||
Updated•7 years ago
|
Comment 1•7 years ago
|
||
![]() |
||
Updated•7 years ago
|
Comment 2•7 years ago
|
||
![]() |
||
Comment 3•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Comment 4•3 years ago
|
||
Seems to be working fine now. Must've gotten fixed in a duplicate somewhere along the way.
Comment 5•3 years ago
|
||
Or maybe not "fixed" in Firefox: example.com now sends a sensible header rather than (apparently?) echoing back the Accept:
values:
content-type: text/html; charset=UTF-8
Since Content-Type is defined as having only one value, browsers interpret the commas as indicating coalesced multiple headers and split them there. Then maybe we chose the last header ("/" is invalid and ignored). Chrome may have chosen the first occurrence rather than the last. Historically this has not been well-defined, but the current version of the spec (RFC 7231) tries, suggesting
Authors of specifications defining new header fields are advised to consider documenting:
Whether the field is a single value or whether it can be a list (delimited by commas; see Section 3.2 of [RFC7230]).
If it does not use the list syntax, document how to treat messages where the field occurs multiple times (a sensible default would be to ignore the field, but this might not always be the right choice).
Unfortunately, that same spec--where "Content-Type" is defined (section 3.1.1.5)--doesn't follow it's own advice that I can see. The closest is that one statement suggesting a "sensible default" that "might not always be the right choice". The spec is clear that Content-Type is a single-value field, though.
About a year before this bug was filed Chrome and Firefox appeared to agree and take the last valid header, but it's messy:
https://github.com/whatwg/mimesniff/issues/30#issuecomment-333821690
The current version of the WHATWG Fetch spec was updated to be clear that the last (good) value should be used, based on web-compatibility in practice. That would mean interpreting the previous site behavior as image/apng
was correct:
https://fetch.spec.whatwg.org/#example-extract-a-mime-type
Updated•3 years ago
|
Description
•