summaryrefslogtreecommitdiffstats
path: root/net/http/http_util.h
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 06:03:16 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 06:03:16 +0000
commit56eab2f216ce86217149753a407f981cb6d5de6c (patch)
treebf4b45a8fbb845b5ec177332df0ebafcfaedb98f /net/http/http_util.h
parent9b961c91eeb8ba43be7918563a07432cbcb1c4df (diff)
downloadchromium_src-56eab2f216ce86217149753a407f981cb6d5de6c.zip
chromium_src-56eab2f216ce86217149753a407f981cb6d5de6c.tar.gz
chromium_src-56eab2f216ce86217149753a407f981cb6d5de6c.tar.bz2
Improve parsing of the Content-Disposition header
Previous, we were using GetHeaderParamValue to parse the Content-Disposition header, which describes itself as a "quick and dirty implementation." After this patch, we use more of our normal HTTP parsing machinery, making our parsing much less quirky and better aligned with RFC 6266. Some notes: 1) Many of the test cases for parsing the Content-Disposition header included the string "Content-Disposition: " in the input. I've looked through all of the callers of these functions, and that seems to be completely bogus. The old parser wasn't careful enough to see that as a problem, but the new one follows the spec more closely. I've updated the test cases to remove this string. 2) After this patch, there's a bunch of code in net_util.cc that really should be moved to http_content_disposition.cc. I didn't move that code in this patch because I didn't want this path to be too large. I'll move it in a future patch. 3) In a future patch, I'll audit the codebase for callers of GetHeaderParamValue. With any luck, we'll be able to remove them all and delete this less-than-amazing function. BUG=65423 Review URL: http://codereview.chromium.org/9234055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_util.h')
-rw-r--r--net/http/http_util.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 9a4b8ce..a09377e 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -307,9 +307,13 @@ class NET_EXPORT HttpUtil {
}
std::string value() const {
return value_is_quoted_ ? unquoted_value_ : std::string(value_begin_,
- value_end_);
+ value_end_);
}
+ // The value before unquoting (if any).
+ std::string raw_value() const { return std::string(value_begin_,
+ value_end_); }
+
private:
HttpUtil::ValuesIterator props_;
bool valid_;