Chromium Code Reviews| Index: Source/core/loader/LinkHeader.cpp |
| diff --git a/Source/core/loader/LinkHeader.cpp b/Source/core/loader/LinkHeader.cpp |
| index e9adad68e923b3ac3f845d7737d073365f95aa23..e2ae03566a13ca4e7baa50166edc04930d3037e5 100644 |
| --- a/Source/core/loader/LinkHeader.cpp |
| +++ b/Source/core/loader/LinkHeader.cpp |
| @@ -25,7 +25,16 @@ static bool isValidURLChar(CharType chr) |
| template <typename CharType> |
| static bool isValidParameterNameChar(CharType chr) |
| { |
| - return !isWhitespace(chr) && chr != '='; |
| + // Alpha-numeric is a valid char. |
| + // This is likely the common case - bailing early. |
| + if ((chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') || (chr >= '0' && chr <= '9')) |
|
Nate Chapin
2015/08/27 23:11:48
Can we simplify some of this function by reusing h
|
| + return true; |
| + // A separator or CTL or '%', '*' or '\'' means the char is not valid. |
| + if (chr <= ' ' || chr > '|' || chr == '{' || chr == ']' || chr == '[' |
| + || chr == '/' || chr == '\\' || (chr <= '@' && chr >= ':') || chr == ',' |
| + || (chr >= '(' && chr <= '*') || chr == '\'' || chr == '"' || chr == '%') |
|
Nate Chapin
2015/08/27 23:11:48
Nit: add {}
|
| + return false; |
| + return true; |
| } |
| template <typename CharType> |
| @@ -40,6 +49,7 @@ static bool isValidParameterValueChar(CharType chr) |
| return !isWhitespace(chr) && !isValidParameterValueEnd(chr); |
| } |
| +// Verify that the parameter is a link-extension which according to spec doesn't have to have a value. |
| static bool isExtensionParameter(LinkHeader::LinkParameterName name) |
| { |
| return name > LinkHeader::LinkParameterAnchor; |