Skip to content
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

"Extract a MIME type" algorithm should pick the first entry? #529

Closed
tyoshino opened this issue Apr 20, 2017 · 7 comments
Closed

"Extract a MIME type" algorithm should pick the first entry? #529

tyoshino opened this issue Apr 20, 2017 · 7 comments

Comments

@tyoshino
Copy link
Member

extract header list values algorithm returns a list. extract a MIME type and sites calling extract a MIME type look using the result as a byte sequence.

Should extract a MIME type pick the first entry of the result of extract header list values if it's not null?

@annevk
Copy link
Member

annevk commented Apr 20, 2017

Yeah, although we should probably have tests for multiple Content-Type headers. I haven't researched that much at all.

@tyoshino
Copy link
Member Author

I see. Considering the following, extract header list values would return failure when there are multiple entries. So, the fix is not what I said in the OP but pick the single entry while asserting it's a single element list if it's not either null or failure.

@annevk
Copy link
Member

annevk commented Apr 20, 2017

Is that what browsers implement? What if you navigate to a URL with two Content-Type headers. Do you get a network error? We should probably have a bunch of web-platform-tests. The HTTP WG generally does a bad job of making sure their requirements can actually be implemented.

@tyoshino
Copy link
Member Author

Chrome's fetch() is currently broken (Blink's ExtractMIMEType is using combined value http://crbug.com/713634), but looks Chrome has been not erroring for multiple Content-Types but using the last Content-Type header before the break.

Navigating to a resource with multiple Content-Type also works. Haven't checked which one is used for navigation.

@annevk
Copy link
Member

annevk commented Sep 4, 2017

Another angle to test would be a single Content-Type header with a comma-separated value. They ought to be treated identically, but browsers...

Relates to whatwg/mimesniff#30.

@annevk
Copy link
Member

annevk commented Apr 19, 2018

whatwg/mimesniff#30 (comment) has my findings on this. Input there much appreciated, even though we'll likely define it here.

annevk added a commit that referenced this issue Nov 9, 2018
Also known as "extract a MIME type" down right.

Tests: web-platform-tests/wpt#10525.

Helps with #814.

Fixes #529. Closes whatwg/mimesniff#30.
annevk added a commit that referenced this issue Nov 12, 2018
Also known as "extract a MIME type" down right.

Tests: web-platform-tests/wpt#10525.

Helps with #814.

Fixes #529. Closes whatwg/mimesniff#30.
@annevk
Copy link
Member

annevk commented Nov 13, 2018

For anyone subscribed to this issue, please note that #831 is pretty close towards solving this. Tests are linked from there as well.

annevk added a commit that referenced this issue Nov 27, 2018
Also known as "extract a MIME type" done right.

Tests: web-platform-tests/wpt#10525.

Helps with #814.

Fixes #529. Closes whatwg/mimesniff#30.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants