summaryrefslogtreecommitdiffstats
path: root/net/http/http_util.h
diff options
context:
space:
mode:
authorestark <estark@chromium.org>2015-07-27 10:11:14 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-27 17:12:04 +0000
commit83487b6773bbda6a46191dede6010ec90e5a9ae8 (patch)
tree9adc0415da127e2ea885b40b7898c63c71aba1ed /net/http/http_util.h
parent92953637fee4908d66f0e05a4b42fc808b396e45 (diff)
downloadchromium_src-83487b6773bbda6a46191dede6010ec90e5a9ae8.zip
chromium_src-83487b6773bbda6a46191dede6010ec90e5a9ae8.tar.gz
chromium_src-83487b6773bbda6a46191dede6010ec90e5a9ae8.tar.bz2
Parse HPKP report-uri and persist in TransportSecurityPersister
This CL parses the report-uri attribute on HPKP headers and stores them in TransportSecurityPersister. This is CL #1. CL #2: crrev.com/1212973002 (add net::CertificateReportSender) CL #3: crrev.com/1212613004 (build and send HPKP reports) BUG=445793 Committed: https://crrev.com/1320e36d908427d615357df1630348bfb38cb5c4 Cr-Commit-Position: refs/heads/master@{#339667} Review URL: https://codereview.chromium.org/1211363005 Cr-Commit-Position: refs/heads/master@{#340490}
Diffstat (limited to 'net/http/http_util.h')
-rw-r--r--net/http/http_util.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 79a41ac..1bb3c93 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -29,14 +29,6 @@ class NET_EXPORT HttpUtil {
// is stripped (username, password, reference).
static std::string SpecForRequest(const GURL& url);
- // Locates the next occurance of delimiter in line, skipping over quoted
- // strings (e.g., commas will not be treated as delimiters if they appear
- // within a quoted string). Returns the offset of the found delimiter or
- // line.size() if no delimiter was found.
- static size_t FindDelimiter(const std::string& line,
- size_t search_start,
- char delimiter);
-
// Parses the value of a Content-Type header. The resulting mime_type and
// charset values are normalized to lowercase. The mime_type and charset
// output values are only modified if the content_type_str contains a mime
@@ -323,9 +315,22 @@ class NET_EXPORT HttpUtil {
// calls to GetNext() or after the NameValuePairsIterator is destroyed.
class NET_EXPORT NameValuePairsIterator {
public:
+ // Whether or not values are optional. VALUES_OPTIONAL allows
+ // e.g. name1=value1;name2;name3=value3, whereas VALUES_NOT_OPTIONAL
+ // will treat it as a parse error because name2 does not have a
+ // corresponding equals sign.
+ enum OptionalValues { VALUES_OPTIONAL, VALUES_NOT_OPTIONAL };
+
+ NameValuePairsIterator(std::string::const_iterator begin,
+ std::string::const_iterator end,
+ char delimiter,
+ OptionalValues optional_values);
+
+ // Treats values as not optional by default (VALUES_NOT_OPTIONAL).
NameValuePairsIterator(std::string::const_iterator begin,
std::string::const_iterator end,
char delimiter);
+
~NameValuePairsIterator();
// Advances the iterator to the next pair, if any. Returns true if there
@@ -353,6 +358,8 @@ class NET_EXPORT HttpUtil {
value_end_);
}
+ bool value_is_quoted() const { return value_is_quoted_; }
+
// The value before unquoting (if any).
std::string raw_value() const { return std::string(value_begin_,
value_end_); }
@@ -373,6 +380,10 @@ class NET_EXPORT HttpUtil {
std::string unquoted_value_;
bool value_is_quoted_;
+
+ // True if values are required for each name/value pair; false if a
+ // name is permitted to appear without a corresponding value.
+ bool values_optional_;
};
};