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

Side by Side Diff: Source/core/fetch/CrossOriginAccessControl.cpp

Issue 99733002: Update HTTPHeaderMap wrappers to use AtomicString type for header values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years 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
« no previous file with comments | « Source/core/fetch/CrossOriginAccessControl.h ('k') | Source/core/fetch/ScriptResource.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 23 matching lines...) Expand all
34 #include "wtf/text/AtomicString.h" 34 #include "wtf/text/AtomicString.h"
35 #include "wtf/text/StringBuilder.h" 35 #include "wtf/text/StringBuilder.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 bool isOnAccessControlSimpleRequestMethodWhitelist(const String& method) 39 bool isOnAccessControlSimpleRequestMethodWhitelist(const String& method)
40 { 40 {
41 return method == "GET" || method == "HEAD" || method == "POST"; 41 return method == "GET" || method == "HEAD" || method == "POST";
42 } 42 }
43 43
44 bool isOnAccessControlSimpleRequestHeaderWhitelist(const String& name, const Str ing& value) 44 bool isOnAccessControlSimpleRequestHeaderWhitelist(const AtomicString& name, con st AtomicString& value)
45 { 45 {
46 if (equalIgnoringCase(name, "accept") 46 if (equalIgnoringCase(name, "accept")
47 || equalIgnoringCase(name, "accept-language") 47 || equalIgnoringCase(name, "accept-language")
48 || equalIgnoringCase(name, "content-language") 48 || equalIgnoringCase(name, "content-language")
49 || equalIgnoringCase(name, "origin") 49 || equalIgnoringCase(name, "origin")
50 || equalIgnoringCase(name, "referer")) 50 || equalIgnoringCase(name, "referer"))
51 return true; 51 return true;
52 52
53 // Preflight is required for MIME types that can not be sent via form submis sion. 53 // Preflight is required for MIME types that can not be sent via form submis sion.
54 if (equalIgnoringCase(name, "content-type")) { 54 if (equalIgnoringCase(name, "content-type")) {
55 String mimeType = extractMIMETypeFromMediaType(value); 55 AtomicString mimeType = extractMIMETypeFromMediaType(value);
56 return equalIgnoringCase(mimeType, "application/x-www-form-urlencoded") 56 return equalIgnoringCase(mimeType, "application/x-www-form-urlencoded")
57 || equalIgnoringCase(mimeType, "multipart/form-data") 57 || equalIgnoringCase(mimeType, "multipart/form-data")
58 || equalIgnoringCase(mimeType, "text/plain"); 58 || equalIgnoringCase(mimeType, "text/plain");
59 } 59 }
60 60
61 return false; 61 return false;
62 } 62 }
63 63
64 bool isSimpleCrossOriginAccessRequest(const String& method, const HTTPHeaderMap& headerMap) 64 bool isSimpleCrossOriginAccessRequest(const String& method, const HTTPHeaderMap& headerMap)
65 { 65 {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 Vector<String> headers; 187 Vector<String> headers;
188 headerValue.split(',', false, headers); 188 headerValue.split(',', false, headers);
189 for (unsigned headerCount = 0; headerCount < headers.size(); headerCount++) { 189 for (unsigned headerCount = 0; headerCount < headers.size(); headerCount++) {
190 String strippedHeader = headers[headerCount].stripWhiteSpace(); 190 String strippedHeader = headers[headerCount].stripWhiteSpace();
191 if (!strippedHeader.isEmpty()) 191 if (!strippedHeader.isEmpty())
192 headerSet.add(strippedHeader); 192 headerSet.add(strippedHeader);
193 } 193 }
194 } 194 }
195 195
196 } // namespace WebCore 196 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/fetch/CrossOriginAccessControl.h ('k') | Source/core/fetch/ScriptResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698