| Index: net/http/http_util.cc
|
| diff --git a/net/http/http_util.cc b/net/http/http_util.cc
|
| index f1e5143e701a5334499dccc9a814ae4c96d2023b..9e30ed60103b790eb43d8bc39f9921b84d9a27ee 100644
|
| --- a/net/http/http_util.cc
|
| +++ b/net/http/http_util.cc
|
| @@ -346,6 +346,32 @@ bool HttpUtil::IsValidHeaderValue(const std::string& value) {
|
| }
|
|
|
| // static
|
| +bool HttpUtil::IsValidHeaderValueRFC7230(const std::string& value) {
|
| + return IsValidHeaderValueRFC7230(value.begin(), value.end());
|
| +}
|
| +
|
| +// static
|
| +bool HttpUtil::IsValidHeaderValueRFC7230(
|
| + std::string::const_iterator value_begin,
|
| + std::string::const_iterator value_end) {
|
| + // Empty string is a valid header-value.
|
| + if (value_begin == value_end)
|
| + return true;
|
| +
|
| + // Check leading/trailing whitespaces.
|
| + if (IsLWS(*value_begin) || IsLWS(*(value_end - 1)))
|
| + return false;
|
| +
|
| + // Check each octet is |field-vchar|, |SP| or |HTAB|.
|
| + for (; value_begin != value_end; ++value_begin) {
|
| + unsigned char c = *value_begin;
|
| + if (c == 0x7F || c > 0xFF || (c < 0x20 && c != '\t'))
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +// static
|
| std::string HttpUtil::StripHeaders(const std::string& headers,
|
| const char* const headers_to_remove[],
|
| size_t headers_to_remove_len) {
|
|
|