OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 * | 24 * |
25 */ | 25 */ |
26 | 26 |
27 #ifndef CrossOriginAccessControl_h | 27 #ifndef CrossOriginAccessControl_h |
28 #define CrossOriginAccessControl_h | 28 #define CrossOriginAccessControl_h |
29 | 29 |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
31 #include "core/fetch/ResourceLoaderOptions.h" | 31 #include "core/fetch/ResourceLoaderOptions.h" |
32 #include "platform/network/ResourceRequest.h" | 32 #include "platform/network/ResourceRequest.h" |
| 33 #include "wtf/Allocator.h" |
33 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
34 #include "wtf/HashSet.h" | 35 #include "wtf/HashSet.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 typedef HashSet<String, CaseFoldingHash> HTTPHeaderSet; | 39 typedef HashSet<String, CaseFoldingHash> HTTPHeaderSet; |
39 | 40 |
40 class Resource; | 41 class Resource; |
41 struct ResourceLoaderOptions; | 42 struct ResourceLoaderOptions; |
42 class ResourceRequest; | 43 class ResourceRequest; |
43 class ResourceResponse; | 44 class ResourceResponse; |
44 class SecurityOrigin; | 45 class SecurityOrigin; |
45 | 46 |
46 class CrossOriginAccessControl { | 47 class CrossOriginAccessControl { |
| 48 STATIC_ONLY(CrossOriginAccessControl); |
47 public: | 49 public: |
48 // Given the new request URL, returns true if | 50 // Given the new request URL, returns true if |
49 // - the URL has a CORS supported scheme and | 51 // - the URL has a CORS supported scheme and |
50 // - the URL does not contain the userinfo production. | 52 // - the URL does not contain the userinfo production. |
51 static bool isLegalRedirectLocation(const KURL&, String& errorDescription); | 53 static bool isLegalRedirectLocation(const KURL&, String& errorDescription); |
52 static bool handleRedirect(SecurityOrigin*, ResourceRequest&, const Resource
Response&, StoredCredentials, ResourceLoaderOptions&, String&); | 54 static bool handleRedirect(SecurityOrigin*, ResourceRequest&, const Resource
Response&, StoredCredentials, ResourceLoaderOptions&, String&); |
53 }; | 55 }; |
54 | 56 |
55 CORE_EXPORT bool isOnAccessControlResponseHeaderWhitelist(const String&); | 57 CORE_EXPORT bool isOnAccessControlResponseHeaderWhitelist(const String&); |
56 | 58 |
57 void updateRequestForAccessControl(ResourceRequest&, SecurityOrigin*, StoredCred
entials); | 59 void updateRequestForAccessControl(ResourceRequest&, SecurityOrigin*, StoredCred
entials); |
58 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest&, Secu
rityOrigin*); | 60 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest&, Secu
rityOrigin*); |
59 | 61 |
60 bool passesAccessControlCheck(const ResourceResponse&, StoredCredentials, Securi
tyOrigin*, String& errorDescription); | 62 bool passesAccessControlCheck(const ResourceResponse&, StoredCredentials, Securi
tyOrigin*, String& errorDescription); |
61 bool passesPreflightStatusCheck(const ResourceResponse&, String& errorDescriptio
n); | 63 bool passesPreflightStatusCheck(const ResourceResponse&, String& errorDescriptio
n); |
62 CORE_EXPORT void parseAccessControlExposeHeadersAllowList(const String& headerVa
lue, HTTPHeaderSet&); | 64 CORE_EXPORT void parseAccessControlExposeHeadersAllowList(const String& headerVa
lue, HTTPHeaderSet&); |
63 | 65 |
64 } // namespace blink | 66 } // namespace blink |
65 | 67 |
66 #endif // CrossOriginAccessControl_h | 68 #endif // CrossOriginAccessControl_h |
OLD | NEW |