summaryrefslogtreecommitdiffstats
path: root/net/base/net_util.cc
diff options
context:
space:
mode:
authorasanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-07 16:58:03 +0000
committerasanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-07 16:58:03 +0000
commit6f50ba4acf5090a3d11f38535c749477e8a74332 (patch)
tree37f0c447da51a0067a939593bcb21388f2c3abec /net/base/net_util.cc
parentb8b0ffd754fe0d9b83a7427f5d4aceb5567c9c96 (diff)
downloadchromium_src-6f50ba4acf5090a3d11f38535c749477e8a74332.zip
chromium_src-6f50ba4acf5090a3d11f38535c749477e8a74332.tar.gz
chromium_src-6f50ba4acf5090a3d11f38535c749477e8a74332.tar.bz2
Don't discard a header parameter because of unbalanced quotes.
Some web servers reportedly send header parameters that aren't quoted properly. So we end up with headers like: Content-Disposition: attachment; filename="Foo.bar Rather than discarding the filename parameter in this case, we now treat it as if there was a closing quote at the end of the line. BUG=58840 TEST=net_unittests --gtest_filter=NetUtilTest.GetFileNameFromCD Review URL: http://codereview.chromium.org/6802019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80797 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_util.cc')
-rw-r--r--net/base/net_util.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index ed74748..8ab1367 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -442,11 +442,12 @@ STR GetHeaderParamValueT(const STR& header, const STR& param_name,
typename STR::const_iterator param_end;
if (*param_begin == '"' && quote_rule == QuoteRule::REMOVE_OUTER_QUOTES) {
- param_end = find(param_begin+1, header.end(), '"');
- if (param_end == header.end())
- return STR(); // poorly formatted param?
-
++param_begin; // skip past the quote.
+ param_end = find(param_begin, header.end(), '"');
+ // If the closing quote is missing, we will treat the rest of the
+ // string as the parameter. We can't set |param_end| to the
+ // location of the separator (';'), since the separator is
+ // technically quoted. See: http://crbug.com/58840
} else {
param_end = find(param_begin+1, header.end(), ';');
}