| 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 "core/inspector/InspectorInstrumentation.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 { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // `application/x-www-form-urlencoded`, `multipart/form-data`, and | 92 // `application/x-www-form-urlencoded`, `multipart/form-data`, and |
| 93 // `text/plain`." | 93 // `text/plain`." |
| 94 // Treat 'Save-Data' as a simple header, since it is added by Chrome when | 94 // Treat 'Save-Data' as a simple header, since it is added by Chrome when |
| 95 // Data Saver feature is enabled. | 95 // Data Saver feature is enabled. |
| 96 // Treat inspector header as a simple header, since it is added by blink whe
n | 96 // Treat inspector header as a simple header, since it is added by blink whe
n |
| 97 // inspector is open. | 97 // inspector is open. |
| 98 | 98 |
| 99 if (equalIgnoringCase(name, "accept") | 99 if (equalIgnoringCase(name, "accept") |
| 100 || equalIgnoringCase(name, "accept-language") | 100 || equalIgnoringCase(name, "accept-language") |
| 101 || equalIgnoringCase(name, "content-language") | 101 || equalIgnoringCase(name, "content-language") |
| 102 || equalIgnoringCase(name, InspectorInstrumentation::kInspectorEmulateNe
tworkConditionsClientId) | 102 || equalIgnoringCase(name, HTTPNames::X_DevTools_Emulate_Network_Conditi
ons_Client_Id) |
| 103 || equalIgnoringCase(name, "save-data")) | 103 || equalIgnoringCase(name, "save-data")) |
| 104 return true; | 104 return true; |
| 105 | 105 |
| 106 if (equalIgnoringCase(name, "content-type")) { | 106 if (equalIgnoringCase(name, "content-type")) { |
| 107 AtomicString mimeType = extractMIMETypeFromMediaType(value); | 107 AtomicString mimeType = extractMIMETypeFromMediaType(value); |
| 108 return equalIgnoringCase(mimeType, "application/x-www-form-urlencoded") | 108 return equalIgnoringCase(mimeType, "application/x-www-form-urlencoded") |
| 109 || equalIgnoringCase(mimeType, "multipart/form-data") | 109 || equalIgnoringCase(mimeType, "multipart/form-data") |
| 110 || equalIgnoringCase(mimeType, "text/plain"); | 110 || equalIgnoringCase(mimeType, "text/plain"); |
| 111 } | 111 } |
| 112 | 112 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 String FetchUtils::normalizeHeaderValue(const String& value) | 203 String FetchUtils::normalizeHeaderValue(const String& value) |
| 204 { | 204 { |
| 205 // https://fetch.spec.whatwg.org/#concept-header-value-normalize | 205 // https://fetch.spec.whatwg.org/#concept-header-value-normalize |
| 206 // Strip leading and trailing whitespace from header value. | 206 // Strip leading and trailing whitespace from header value. |
| 207 // HTTP whitespace bytes are 0x09, 0x0A, 0x0D, and 0x20. | 207 // HTTP whitespace bytes are 0x09, 0x0A, 0x0D, and 0x20. |
| 208 | 208 |
| 209 return value.stripWhiteSpace(isHTTPWhitespace); | 209 return value.stripWhiteSpace(isHTTPWhitespace); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace blink | 212 } // namespace blink |
| OLD | NEW |