summaryrefslogtreecommitdiffstats
path: root/net/http/http_content_disposition_unittest.cc
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-31 03:25:30 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-31 03:25:30 +0000
commita44776c18ffd78765568649ec912fd0a67363f6e (patch)
tree22a8aa3a552631a416425d757bc4188aa239f794 /net/http/http_content_disposition_unittest.cc
parent9e349767fdd20fd2373718c216a804758d4d36fb (diff)
downloadchromium_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_content_disposition_unittest.cc')
-rw-r--r--net/http/http_content_disposition_unittest.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/http/http_content_disposition_unittest.cc b/net/http/http_content_disposition_unittest.cc
index 0bba0b6..7587c3e 100644
--- a/net/http/http_content_disposition_unittest.cc
+++ b/net/http/http_content_disposition_unittest.cc
@@ -212,7 +212,7 @@ TEST(HttpContentDispositionTest, tc2231) {
},
// http://greenbytes.de/tech/tc2231/#inlonlyquoted
{ "\"inline\"",
- net::HttpContentDisposition::ATTACHMENT,
+ net::HttpContentDisposition::INLINE,
L""
},
// http://greenbytes.de/tech/tc2231/#inlwithasciifilename
@@ -237,7 +237,7 @@ TEST(HttpContentDispositionTest, tc2231) {
},
// http://greenbytes.de/tech/tc2231/#attonlyquoted
{ "\"attachment\"",
- net::HttpContentDisposition::ATTACHMENT,
+ net::HttpContentDisposition::INLINE,
L""
},
// http://greenbytes.de/tech/tc2231/#attonly403
@@ -364,7 +364,7 @@ TEST(HttpContentDispositionTest, tc2231) {
// Note: tc2231 says we should fail to parse this header.
{ "attachment; filename=\"foo.html\"; filename=\"bar.html\"",
net::HttpContentDisposition::ATTACHMENT,
- L"bar.html" // Probably should be foo.html to match other browsers.
+ L"foo.html"
},
// http://greenbytes.de/tech/tc2231/#attfnbrokentoken
// Note: tc2231 says we should fail to parse this header.
@@ -401,8 +401,8 @@ TEST(HttpContentDispositionTest, tc2231) {
// http://greenbytes.de/tech/tc2231/#attmissingdisposition3
// Note: tc2231 says we should fail to parse this header.
{ "\"foo; filename=bar;baz\"; filename=qux",
- net::HttpContentDisposition::ATTACHMENT,
- L"bar" // Firefox gets qux
+ net::HttpContentDisposition::INLINE,
+ L"" // Firefox gets qux
},
// http://greenbytes.de/tech/tc2231/#attmissingdisposition4
// Note: tc2231 says we should fail to parse this header.
@@ -447,10 +447,10 @@ TEST(HttpContentDispositionTest, tc2231) {
L"foo\"bar;baz\"qux"
},
// http://greenbytes.de/tech/tc2231/#attmultinstances
- { "attachment; filename=foo.html, attachment; filename=bar.html",
// Note: tc2231 says we should fail to parse this header.
+ { "attachment; filename=foo.html, attachment; filename=bar.html",
net::HttpContentDisposition::ATTACHMENT,
- L"bar.html"
+ L"foo.html, attachment"
},
// http://greenbytes.de/tech/tc2231/#attmissingdelim
{ "attachment; foo=foo filename=bar",