| Index: net/http/http_util.h
|
| diff --git a/net/http/http_util.h b/net/http/http_util.h
|
| index 458a7187441a253e2ad862785fb076824f1643c6..e1b68b999920fdd3b27db6b51cbea8d37cdab8a0 100644
|
| --- a/net/http/http_util.h
|
| +++ b/net/http/http_util.h
|
| @@ -134,6 +134,17 @@ class NET_EXPORT HttpUtil {
|
| // Same as above.
|
| static std::string Unquote(const std::string& str);
|
|
|
| + // Similar to Unquote(), but additionally validates that the string being
|
| + // unescaped actually is a valid quoted string. Returns false for an empty
|
| + // string, a string without quotes, a string with mismatched quotes, and
|
| + // a string with unescaped embeded quotes.
|
| + static bool StrictUnquote(std::string::const_iterator begin,
|
| + std::string::const_iterator end,
|
| + std::string* out);
|
| +
|
| + // Same as above.
|
| + static bool StrictUnquote(const std::string& str, std::string* out);
|
| +
|
| // The reverse of Unquote() -- escapes and surrounds with "
|
| static std::string Quote(const std::string& str);
|
|
|
| @@ -338,10 +349,17 @@ class NET_EXPORT HttpUtil {
|
| // corresponding equals sign.
|
| enum OptionalValues { VALUES_OPTIONAL, VALUES_NOT_OPTIONAL };
|
|
|
| + // Whether or not unmatched quotes should be considered a failure. By
|
| + // default this class is pretty lenient and does a best effort to parse
|
| + // values with mismatched quotes. When set to STRICT_QUOTES a value with
|
| + // mismatched or otherwise invalid quotes is considered a parse error.
|
| + enum StrictQuotes { STRICT_QUOTES, NON_STRICT_QUOTES };
|
| +
|
| NameValuePairsIterator(std::string::const_iterator begin,
|
| std::string::const_iterator end,
|
| char delimiter,
|
| - OptionalValues optional_values);
|
| + OptionalValues optional_values,
|
| + StrictQuotes strict_quotes = NON_STRICT_QUOTES);
|
|
|
| // Treats values as not optional by default (VALUES_NOT_OPTIONAL).
|
| NameValuePairsIterator(std::string::const_iterator begin,
|
| @@ -403,6 +421,8 @@ class NET_EXPORT HttpUtil {
|
| // 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_;
|
| +
|
| + bool strict_quotes_;
|
| };
|
| };
|
|
|
|
|