diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-31 03:25:30 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-31 03:25:30 +0000 |
commit | a44776c18ffd78765568649ec912fd0a67363f6e (patch) | |
tree | 22a8aa3a552631a416425d757bc4188aa239f794 /net/http/http_util.h | |
parent | 9e349767fdd20fd2373718c216a804758d4d36fb (diff) | |
download | chromium_src-a44776c18ffd78765568649ec912fd0a67363f6e.zip chromium_src-a44776c18ffd78765568649ec912fd0a67363f6e.tar.gz chromium_src-a44776c18ffd78765568649ec912fd0a67363f6e.tar.bz2 |
This patch tunes our parsing of the Content-Disposition header to match other
browsers and the specs slightly better.
There are two changes in this patch:
1) We now require disposition-type to match the RFC 2616 token production in
order to treat the response as an attachment (i.e., a download).
2) When there are multiple filename parameters, we now take the first one,
which maches our behavior prior to the new parser and matches what other
browsers do.
Review URL: http://codereview.chromium.org/9225046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_util.h')
-rw-r--r-- | net/http/http_util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/http/http_util.h b/net/http/http_util.h index 41f2713..57aa0d0 100644 --- a/net/http/http_util.h +++ b/net/http/http_util.h @@ -104,6 +104,13 @@ class NET_EXPORT HttpUtil { // Whether the character is the start of a quotation mark. static bool IsQuote(char c); + // Whether the string is a valid |token| as defined in RFC 2616 Sec 2.2. + static bool IsToken(std::string::const_iterator begin, + std::string::const_iterator end); + static bool IsToken(const std::string& str) { + return IsToken(str.begin(), str.end()); + } + // RFC 2616 Sec 2.2: // quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) // Unquote() strips the surrounding quotemarks off a string, and unescapes |