-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content-Type header parsing #39
Comments
|
This appears like a browser issue to me. There is and never was an intention to have different rules. |
|
I'm not sure what that means. If it affects browsers, why would it not affect other clients in the HTTP ecosystem? Don't we all consume the same content? |
|
Once again, there are no different rules. Browsers apparently implemented workarounds for misconfigured servers, but that doesn't mean that what browsers do is what everybody else is doing. |
|
Do we need to do more than reference mimesniff (see #51)? Note there's already generic text about sniffing in Content-Type. |
|
This issue is really about parsing |
|
More concretely, whatwg/fetch#831 has a patch for Fetch to define this in detail with an acknowledgment that it doesn't match HTTP. It seems greatly preferable to uplift this kind of thing and agree on header parsers across the HTTP ecosystem, but if that's not doable so be it. |
|
Discussed in Basel; we could document a suggested error handling algorithm, as long as it's clear that rejecting the message because the content-type is invalid is still acceptable. Suggested algorithm would be to use the last syntactically valid type. @annevk does that align with fetch? |
|
More than today, but it's also more involved: https://fetch.spec.whatwg.org/#content-type-header. |
|
Waiting for terminology from #193. |
|
I just updated my ancient tests for content-type, see http://test.greenbytes.de/tech/tc/httpcontenttype. To my surprise, Safari apparently handles comma-separated different from multiple fields, see http://test.greenbytes.de/tech/tc/httpcontenttype/#multitextxmloneline. @annevk, that would be a bug according to FETCH, right? |
|
Yes, I suspect there's a bug filed already. I think I found such bugs in all browsers as they all have very similar logic in their core HTTP parsers. |
|
Ah. But then, I'm not really convinced that we should add this to the spec. My understanding that the request was based on browsers already agreeing on the error handling... |
|
There's no complete agreement on all details involved. See whatwg/fetch#831 (comment) for links to bugs. |
|
I did some more testing with Java client libs (HTTPURLConnection, JDK HttpClient, Apache HttpClient). Of these, only the first seems to have an API getting the type directly, and that indeed takes the last value (no matter whether sent as list in a single instance, or in multiple fields). It would be nice if there was a concrete Webkit bug that points out their inconsistency (see #39 (comment)) (cc @tfpauly). |
|
I recommend either filing one that blocks https://bugs.webkit.org/show_bug.cgi?id=192000 or detailing the specific case you care about there in a comment. |
This is related to #33, but subtly different. As explored in whatwg/mimesniff#30 browsers have different code paths for request and response
Content-Typeheader parsing. Values such as*/*, text/htmlin a responseContent-Typeheader end up being interpreted astext/html, presumably for compatibility with deployed content.This seems like another fallout of intermediaries adding potentially duplicate headers and (early) implementations being poorly tested for erroneous input.
The text was updated successfully, but these errors were encountered: