Index: third_party/WebKit/Source/core/fetch/FetchUtils.cpp |
diff --git a/third_party/WebKit/Source/core/fetch/FetchUtils.cpp b/third_party/WebKit/Source/core/fetch/FetchUtils.cpp |
index 4139db3f4428bb32a9a66747453e79fd4ffcbf12..72b4429f64535ae6e0a38e8615ddeec5bf046280 100644 |
--- a/third_party/WebKit/Source/core/fetch/FetchUtils.cpp |
+++ b/third_party/WebKit/Source/core/fetch/FetchUtils.cpp |
@@ -16,6 +16,11 @@ namespace blink { |
namespace { |
+bool isHTTPWhitespace(UChar chr) |
+{ |
+ return chr == ' ' || chr == '\n' || chr == '\t' || chr == '\r'; |
+} |
+ |
class ForbiddenHeaderNames { |
WTF_MAKE_NONCOPYABLE(ForbiddenHeaderNames); WTF_MAKE_FAST_ALLOCATED(ForbiddenHeaderNames); |
public: |
@@ -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 |