| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/fetch/FetchUtils.h" | 5 #include "core/fetch/FetchUtils.h" |
| 6 | 6 |
| 7 #include "platform/HTTPNames.h" | 7 #include "platform/HTTPNames.h" |
| 8 #include "platform/network/HTTPHeaderMap.h" | 8 #include "platform/network/HTTPHeaderMap.h" |
| 9 #include "platform/network/HTTPParsers.h" | 9 #include "platform/network/HTTPParsers.h" |
| 10 #include "wtf/HashSet.h" | 10 #include "wtf/HashSet.h" |
| 11 #include "wtf/Threading.h" | 11 #include "wtf/Threading.h" |
| 12 #include "wtf/text/AtomicString.h" | 12 #include "wtf/text/AtomicString.h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 bool isHTTPWhitespace(UChar chr) | 19 bool isHTTPWhitespace(UChar chr) |
| 20 { | 20 { |
| 21 return chr == ' ' || chr == '\n' || chr == '\t' || chr == '\r'; | 21 return chr == ' ' || chr == '\n' || chr == '\t' || chr == '\r'; |
| 22 } | 22 } |
| 23 | 23 |
| 24 class ForbiddenHeaderNames { | 24 class ForbiddenHeaderNames { |
| 25 WTF_MAKE_NONCOPYABLE(ForbiddenHeaderNames); USING_FAST_MALLOC(ForbiddenHeade
rNames); | 25 WTF_MAKE_NONCOPYABLE(ForbiddenHeaderNames); |
| 26 USING_FAST_MALLOC(ForbiddenHeaderNames); |
| 26 public: | 27 public: |
| 27 bool has(const String& name) const | 28 bool has(const String& name) const |
| 28 { | 29 { |
| 29 return m_fixedNames.contains(name) | 30 return m_fixedNames.contains(name) |
| 30 || name.startsWith(m_proxyHeaderPrefix, TextCaseInsensitive) | 31 || name.startsWith(m_proxyHeaderPrefix, TextCaseInsensitive) |
| 31 || name.startsWith(m_secHeaderPrefix, TextCaseInsensitive); | 32 || name.startsWith(m_secHeaderPrefix, TextCaseInsensitive); |
| 32 } | 33 } |
| 33 | 34 |
| 34 static const ForbiddenHeaderNames& get(); | 35 static const ForbiddenHeaderNames& get(); |
| 35 | 36 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 String FetchUtils::normalizeHeaderValue(const String& value) | 210 String FetchUtils::normalizeHeaderValue(const String& value) |
| 210 { | 211 { |
| 211 // https://fetch.spec.whatwg.org/#concept-header-value-normalize | 212 // https://fetch.spec.whatwg.org/#concept-header-value-normalize |
| 212 // Strip leading and trailing whitespace from header value. | 213 // Strip leading and trailing whitespace from header value. |
| 213 // HTTP whitespace bytes are 0x09, 0x0A, 0x0D, and 0x20. | 214 // HTTP whitespace bytes are 0x09, 0x0A, 0x0D, and 0x20. |
| 214 | 215 |
| 215 return value.stripWhiteSpace(isHTTPWhitespace); | 216 return value.stripWhiteSpace(isHTTPWhitespace); |
| 216 } | 217 } |
| 217 | 218 |
| 218 } // namespace blink | 219 } // namespace blink |
| OLD | NEW |