New issue
Advanced search Search tips

Issue 772350 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

MIME type parser should not support single quotes

Project Member Reported by annevank...@gmail.com, Oct 6 2017

Issue description

In particular:

> if (first_char == '"' || first_char == '\'') {

in http_util.cc is incorrect. Only double quoted values are supposed to be supported per the RFC. Chrome is alone in supporting single quotes.
 
(If you believe this should be standardized for some reason, please comment over at https://github.com/whatwg/mimesniff/issues/35. It seems highly unlikely other browsers would want to add this kind of behavior though.)
I'm certainly fine with removing it, after verifying that other browsers don't support single quotes.  Looks like that block of code hasn't been modified since initial.commit, and I don't think it's worth digging before that to try and divine the exact motivation.
Great, FWIW, I plan to work on web-platform-tests once the revised MIME type parser specification is more in order. For now I've scattered my various demo tests in issues on the aforementioned repository. If you end up writing tests as part of fixing this let me know and I can make sure to include them.

(My goal is to get all browsers aligned on parsing MIME types, mostly so I can then get them aligned on processing data: URLs, but also because MIME types are pretty fundamental and deserve to be interoperable by now.)

Comment 4 by b...@chromium.org, Oct 6 2017

Components: -Internals>Network Internals>Network>HTTP
Labels: Needs-Feedback
Owner: b...@chromium.org
Status: Assigned (was: Unconfirmed)
Anne: I'm happy to take this.  You mentioned that Chrome is the only browser accepting single qoutes.  What browsers can you confirm that they reject single quotes?
Edge, Firefox, and Safari. If you put the code mentioned in the linked issue in a resource under web-platform-tests named [something].asis and run it using the web-platform-tests server you should be able to reproduce easily. They will all log windows-1252 rather than GBK.

Comment 6 by b...@chromium.org, Oct 6 2017

Labels: -Needs-Feedback
Status: Started (was: Assigned)
Thank you for your response.  I believe comment #5 satisfies the "after verifying that other browsers don't support single quotes" clause of comment #2.

(I do not have a web-platform-tests server set up on my computer, nor do I have access to Edge or Safari, thanks for checking for me.)
Project Member

Comment 7 by bugdroid1@chromium.org, Oct 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8c1e3076613621477eb18fca29e623be4b73c1a3

commit 8c1e3076613621477eb18fca29e623be4b73c1a3
Author: Bence Béky <bnc@chromium.org>
Date: Mon Oct 09 17:57:21 2017

Do not allow single quotes around Content-Type charset.

Do not allow single quotes around Content-Type charset parameter, in
compliance with RFC 7231 Section 3.1.1.1 ("quoted-string" is defined in
RFC 7230 Section 3.2.6).

Bug:  772350 
Change-Id: Id8cf1676c49d086fce298285546561927ace057b
Reviewed-on: https://chromium-review.googlesource.com/705757
Commit-Queue: Bence Béky <bnc@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#507407}
[modify] https://crrev.com/8c1e3076613621477eb18fca29e623be4b73c1a3/net/http/http_response_headers_unittest.cc
[modify] https://crrev.com/8c1e3076613621477eb18fca29e623be4b73c1a3/net/http/http_util.cc
[modify] https://crrev.com/8c1e3076613621477eb18fca29e623be4b73c1a3/net/http/http_util_unittest.cc

Comment 8 by b...@chromium.org, Oct 9 2017

Status: Fixed (was: Started)
Components: Internals>Network
Components: -Internals>Network>HTTP

Sign in to add a comment