Index: Source/platform/network/HTTPParsers.cpp |
diff --git a/Source/platform/network/HTTPParsers.cpp b/Source/platform/network/HTTPParsers.cpp |
index 7e344e63987720c6f3eae4b6f1d67a57122eaf00..fea6cc4612e7a4a02081221db997b1cba36c75ed 100644 |
--- a/Source/platform/network/HTTPParsers.cpp |
+++ b/Source/platform/network/HTTPParsers.cpp |
@@ -107,6 +107,7 @@ static inline bool skipValue(const String& str, unsigned& pos) |
return pos != start; |
} |
+// See RFC 2616, Section 4.2. |
hiroshige
2015/08/27 11:38:08
Removing this comment might be better, because isV
shiva.jm
2015/09/01 08:26:51
Done.
|
bool isValidHTTPHeaderValue(const String& name) |
{ |
// FIXME: This should really match name against |
@@ -115,13 +116,33 @@ 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. |
-bool isValidHTTPToken(const String& characters) |
+// See RFC 7230, Section 3.2.3. |
hiroshige
2015/08/27 11:38:08
Please add a comment that this function checks whe
shiva.jm
2015/09/01 08:26:51
Done.
|
+bool isValidHTTPHeaderValueForFetch(const String& value) |
{ |
hiroshige
2015/08/27 11:38:08
Please add:
if (value.isEmpty())
return false;
shiva.jm
2015/09/01 08:26:51
Done.
|
- if (characters.isEmpty()) |
+ UChar c = value[0]; |
hiroshige
2015/08/27 11:38:08
c -> firstCharacter, as tkent@ commented.
shiva.jm
2015/09/01 08:26:51
Done.
|
+ if (c == ' ' || c == '\t') |
return false; |
- for (unsigned i = 0; i < characters.length(); ++i) { |
- UChar c = characters[i]; |
+ |
+ c = value[value.length() - 1]; |
hiroshige
2015/08/27 11:38:08
c -> UChar lastCharacter, as tkent@ commented.
shiva.jm
2015/09/01 08:26:51
Done.
|
+ if (c == ' ' || c == '\t') |
+ return false; |
+ |
+ for (unsigned i = 0; i < value.length(); ++i) { |
+ c = value[i]; |
hiroshige
2015/08/27 11:38:08
c -> UChar c.
shiva.jm
2015/09/01 08:26:51
Done.
|
+ if (c == 0x7F || c > 0xFF || (c < 0x20 && c != '\t')) |
+ return false; |
+ } |
+ |
+ return true; |
+} |
+ |
+// See RFC 7230, Section 3.2.6. |
+bool isValidHTTPToken(const String& value) |
hiroshige
2015/08/27 11:38:08
Please retain the name of |characters| instead of
shiva.jm
2015/09/01 08:26:51
Done.
|
+{ |
+ if (value.isEmpty()) |
+ return false; |
+ for (unsigned i = 0; i < value.length(); ++i) { |
+ UChar c = value[i]; |
if (c <= 0x20 || c >= 0x7F |
|| c == '(' || c == ')' || c == '<' || c == '>' || c == '@' |
|| c == ',' || c == ';' || c == ':' || c == '\\' || c == '"' |