Chromium Code Reviews| Index: Source/platform/network/HTTPParsers.cpp |
| diff --git a/Source/platform/network/HTTPParsers.cpp b/Source/platform/network/HTTPParsers.cpp |
| index 7e344e63987720c6f3eae4b6f1d67a57122eaf00..0174dcc709f540cf71b87847cd0cbc8353ad6540 100644 |
| --- a/Source/platform/network/HTTPParsers.cpp |
| +++ b/Source/platform/network/HTTPParsers.cpp |
| @@ -115,7 +115,32 @@ bool isValidHTTPHeaderValue(const String& name) |
| return name.containsOnlyLatin1() && !name.contains('\r') && !name.contains('\n') && !name.contains(static_cast<UChar>('\0')); |
| } |
| -// See RFC 2616, Section 2.2. |
| +// See RFC 7230, Section 3.2.3. |
| +// checks whether |value| matches field-content in RFC 7230. |
| +// link: http://tools.ietf.org/html/rfc7230#section-3.2 |
| +bool isValidHTTPFieldContentRFC7230(const String& value) |
| +{ |
| + if (value.isEmpty()) |
| + return false; |
| + |
| + UChar firstCharacter= value[0]; |
|
hiroshige
2015/09/01 11:21:18
A space before '='.
shiva.jm
2015/09/01 14:29:11
Done.
|
| + if (firstCharacter== ' ' || firstCharacter== '\t') |
|
hiroshige
2015/09/01 11:21:18
A Space before each of '=='s.
shiva.jm
2015/09/01 14:29:11
Done.
|
| + return false; |
| + |
| + UChar lastCharacter = value[value.length() - 1]; |
| + if (lastCharacter == ' ' || lastCharacter == '\t') |
| + return false; |
| + |
| + for (unsigned i = 0; i < value.length(); ++i) { |
| + UChar c = value[i]; |
| + if (c == 0x7F || c > 0xFF || (c < 0x20 && c != '\t')) |
| + return false; |
| + } |
| + |
| + return true; |
| +} |
| + |
| +// See RFC 7230, Section 3.2.6. |
| bool isValidHTTPToken(const String& characters) |
| { |
| if (characters.isEmpty()) |