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

Side by Side Diff: Source/modules/serviceworkers/FetchHeaderList.cpp

Issue 329853012: [ServiceWorker] Make Request class better conformance with the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated jochen's comment Created 6 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 "config.h" 5 #include "config.h"
6 #include "FetchHeaderList.h" 6 #include "FetchHeaderList.h"
7 7
8 #include "core/fetch/CrossOriginAccessControl.h" 8 #include "core/fetch/CrossOriginAccessControl.h"
9 #include "core/xml/XMLHttpRequest.h" 9 #include "core/xml/XMLHttpRequest.h"
10 #include "platform/network/HTTPParsers.h" 10 #include "platform/network/HTTPParsers.h"
11 #include "wtf/PassOwnPtr.h" 11 #include "wtf/PassOwnPtr.h"
12 12
13 namespace WebCore { 13 namespace WebCore {
14 14
15 PassRefPtr<FetchHeaderList> FetchHeaderList::create() 15 PassRefPtr<FetchHeaderList> FetchHeaderList::create()
16 { 16 {
17 return adoptRef(new FetchHeaderList()); 17 return adoptRef(new FetchHeaderList());
18 } 18 }
19 19
20 PassRefPtr<FetchHeaderList> FetchHeaderList::createCopy()
21 {
22 RefPtr<FetchHeaderList> list(create());
23 for (size_t i = 0; i < m_headerList.size(); ++i) {
jochen (gone - plz use gerrit) 2014/07/07 15:31:52 nit. no { } for single line body, here and everywh
horo 2014/07/08 02:05:59 Done.
24 list->append(m_headerList[i]->first, m_headerList[i]->second);
25 }
26 return list.release();
27 }
28
20 FetchHeaderList::FetchHeaderList() 29 FetchHeaderList::FetchHeaderList()
21 { 30 {
22 } 31 }
23 32
24 FetchHeaderList::~FetchHeaderList() 33 FetchHeaderList::~FetchHeaderList()
25 { 34 {
26 } 35 }
27 36
28 void FetchHeaderList::append(const String& name, const String& value) 37 void FetchHeaderList::append(const String& name, const String& value)
29 { 38 {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 bool FetchHeaderList::isForbiddenHeaderName(const String& name) 161 bool FetchHeaderList::isForbiddenHeaderName(const String& name)
153 { 162 {
154 // "A forbidden header name is a header names that is one of: 163 // "A forbidden header name is a header names that is one of:
155 // `Accept-Charset`, `Accept-Encoding`, `Access-Control-Request-Headers`, 164 // `Accept-Charset`, `Accept-Encoding`, `Access-Control-Request-Headers`,
156 // `Access-Control-Request-Method`, `Connection`, 165 // `Access-Control-Request-Method`, `Connection`,
157 // `Content-Length, Cookie`, `Cookie2`, `Date`, `DNT`, `Expect`, `Host`, 166 // `Content-Length, Cookie`, `Cookie2`, `Date`, `DNT`, `Expect`, `Host`,
158 // `Keep-Alive`, `Origin`, `Referer`, `TE`, `Trailer`, 167 // `Keep-Alive`, `Origin`, `Referer`, `TE`, `Trailer`,
159 // `Transfer-Encoding`, `Upgrade`, `User-Agent`, `Via` 168 // `Transfer-Encoding`, `Upgrade`, `User-Agent`, `Via`
160 // or starts with `Proxy-` or `Sec-` (including when it is just `Proxy-` or 169 // or starts with `Proxy-` or `Sec-` (including when it is just `Proxy-` or
161 // `Sec-`)." 170 // `Sec-`)."
162 return !XMLHttpRequest::isAllowedHTTPHeader(name); 171 return !XMLHttpRequest::isAllowedHTTPHeader(name) || equalIgnoringCase(name, "DNT");
163 } 172 }
164 173
165 bool FetchHeaderList::isForbiddenResponseHeaderName(const String& name) 174 bool FetchHeaderList::isForbiddenResponseHeaderName(const String& name)
166 { 175 {
167 // "A forbidden response header name is a header name that is one of: 176 // "A forbidden response header name is a header name that is one of:
168 // `Set-Cookie`, `Set-Cookie2`" 177 // `Set-Cookie`, `Set-Cookie2`"
169 return equalIgnoringCase(name, "set-cookie") || equalIgnoringCase(name, "set -cookie2"); 178 return equalIgnoringCase(name, "set-cookie") || equalIgnoringCase(name, "set -cookie2");
170 } 179 }
171 180
172 } // namespace WebCore 181 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698