Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/core/fetch/FetchUtils.cpp

Issue 2142513003: Use initializer_lists for static WTF::HashSets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 27 matching lines...) Expand all
38 38
39 String m_proxyHeaderPrefix; 39 String m_proxyHeaderPrefix;
40 String m_secHeaderPrefix; 40 String m_secHeaderPrefix;
41 HashSet<String, CaseFoldingHash> m_fixedNames; 41 HashSet<String, CaseFoldingHash> m_fixedNames;
42 }; 42 };
43 43
44 ForbiddenHeaderNames::ForbiddenHeaderNames() 44 ForbiddenHeaderNames::ForbiddenHeaderNames()
45 : m_proxyHeaderPrefix("proxy-") 45 : m_proxyHeaderPrefix("proxy-")
46 , m_secHeaderPrefix("sec-") 46 , m_secHeaderPrefix("sec-")
47 { 47 {
48 m_fixedNames.add("accept-charset"); 48 m_fixedNames = {
49 m_fixedNames.add("accept-encoding"); 49 "accept-charset",
50 m_fixedNames.add("access-control-request-headers"); 50 "accept-encoding",
51 m_fixedNames.add("access-control-request-method"); 51 "access-control-request-headers",
52 m_fixedNames.add("connection"); 52 "access-control-request-method",
53 m_fixedNames.add("content-length"); 53 "connection",
54 m_fixedNames.add("cookie"); 54 "content-length",
55 m_fixedNames.add("cookie2"); 55 "cookie",
56 m_fixedNames.add("date"); 56 "cookie2",
57 m_fixedNames.add("dnt"); 57 "date",
58 m_fixedNames.add("expect"); 58 "dnt",
59 m_fixedNames.add("host"); 59 "expect",
60 m_fixedNames.add("keep-alive"); 60 "host",
61 m_fixedNames.add("origin"); 61 "keep-alive",
62 m_fixedNames.add("referer"); 62 "origin",
63 m_fixedNames.add("te"); 63 "referer",
64 m_fixedNames.add("trailer"); 64 "te",
65 m_fixedNames.add("transfer-encoding"); 65 "trailer",
66 m_fixedNames.add("upgrade"); 66 "transfer-encoding",
67 m_fixedNames.add("user-agent"); 67 "upgrade",
68 m_fixedNames.add("via"); 68 "user-agent",
69 "via",
70 };
69 } 71 }
70 72
71 const ForbiddenHeaderNames& ForbiddenHeaderNames::get() 73 const ForbiddenHeaderNames& ForbiddenHeaderNames::get()
72 { 74 {
73 DEFINE_THREAD_SAFE_STATIC_LOCAL(const ForbiddenHeaderNames, instance, new Fo rbiddenHeaderNames); 75 DEFINE_THREAD_SAFE_STATIC_LOCAL(const ForbiddenHeaderNames, instance, new Fo rbiddenHeaderNames);
74 return instance; 76 return instance;
75 } 77 }
76 78
77 } // namespace 79 } // namespace
78 80
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 String FetchUtils::normalizeHeaderValue(const String& value) 205 String FetchUtils::normalizeHeaderValue(const String& value)
204 { 206 {
205 // https://fetch.spec.whatwg.org/#concept-header-value-normalize 207 // https://fetch.spec.whatwg.org/#concept-header-value-normalize
206 // Strip leading and trailing whitespace from header value. 208 // Strip leading and trailing whitespace from header value.
207 // HTTP whitespace bytes are 0x09, 0x0A, 0x0D, and 0x20. 209 // HTTP whitespace bytes are 0x09, 0x0A, 0x0D, and 0x20.
208 210
209 return value.stripWhiteSpace(isHTTPWhitespace); 211 return value.stripWhiteSpace(isHTTPWhitespace);
210 } 212 }
211 213
212 } // namespace blink 214 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698