Index: Source/core/fetch/FetchUtils.cpp |
diff --git a/Source/core/fetch/FetchUtils.cpp b/Source/core/fetch/FetchUtils.cpp |
index 4139db3f4428bb32a9a66747453e79fd4ffcbf12..e21730289e3ef2469a8448159c29d42a9821c271 100644 |
--- a/Source/core/fetch/FetchUtils.cpp |
+++ b/Source/core/fetch/FetchUtils.cpp |
@@ -14,6 +14,11 @@ |
namespace blink { |
+static bool isHTTPWhitespace(UChar chr) |
yhirano
2015/09/09 04:41:50
Please place this function in the unnamed namespac
shiva.jm
2015/09/10 10:10:26
Done.
|
+{ |
+ return chr <= ' ' && (chr == ' ' || chr == '\n' || chr == '\t' || chr == '\r'); |
hiroshige
2015/09/09 07:01:48
"chr <= ' ' && " is not needed.
shiva.jm
2015/09/10 10:10:26
Done.
|
+} |
+ |
namespace { |
class ForbiddenHeaderNames { |
@@ -189,4 +194,13 @@ AtomicString FetchUtils::normalizeMethod(const AtomicString& method) |
return method; |
} |
+String FetchUtils::normalizeHeaderValue(const String& value) |
+{ |
+ // https://fetch.spec.whatwg.org/#concept-header-value-normalize |
+ // Strip leading and trailing whitespace from header value. |
+ // HTTP whitespace bytes are 0x09, 0x0A, 0x0D, and 0x20. |
+ |
+ return value.stripWhiteSpace(isHTTPWhitespace); |
+} |
+ |
} // namespace blink |