OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return true; | 116 return true; |
117 | 117 |
118 errorDescription = "Method " + method + " is not allowed by Access-Control-A
llow-Methods in preflight response."; | 118 errorDescription = "Method " + method + " is not allowed by Access-Control-A
llow-Methods in preflight response."; |
119 return false; | 119 return false; |
120 } | 120 } |
121 | 121 |
122 bool CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders(const HTTPHea
derMap& requestHeaders, String& errorDescription) const | 122 bool CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders(const HTTPHea
derMap& requestHeaders, String& errorDescription) const |
123 { | 123 { |
124 for (const auto& header : requestHeaders) { | 124 for (const auto& header : requestHeaders) { |
125 if (!m_headers.contains(header.key) && !FetchUtils::isSimpleHeader(heade
r.key, header.value) && !FetchUtils::isForbiddenHeaderName(header.key)) { | 125 if (!m_headers.contains(header.key) && !FetchUtils::isSimpleHeader(heade
r.key, header.value) && !FetchUtils::isForbiddenHeaderName(header.key)) { |
126 errorDescription = "Request header field " + header.key.string() + "
is not allowed by Access-Control-Allow-Headers in preflight response."; | 126 errorDescription = "Request header field " + header.key.getString()
+ " is not allowed by Access-Control-Allow-Headers in preflight response."; |
127 return false; | 127 return false; |
128 } | 128 } |
129 } | 129 } |
130 return true; | 130 return true; |
131 } | 131 } |
132 | 132 |
133 bool CrossOriginPreflightResultCacheItem::allowsRequest(StoredCredentials includ
eCredentials, const String& method, const HTTPHeaderMap& requestHeaders) const | 133 bool CrossOriginPreflightResultCacheItem::allowsRequest(StoredCredentials includ
eCredentials, const String& method, const HTTPHeaderMap& requestHeaders) const |
134 { | 134 { |
135 String ignoredExplanation; | 135 String ignoredExplanation; |
136 if (m_absoluteExpiryTime < currentTime()) | 136 if (m_absoluteExpiryTime < currentTime()) |
(...skipping 28 matching lines...) Expand all Loading... |
165 return false; | 165 return false; |
166 | 166 |
167 if (cacheIt->value->allowsRequest(includeCredentials, method, requestHeaders
)) | 167 if (cacheIt->value->allowsRequest(includeCredentials, method, requestHeaders
)) |
168 return true; | 168 return true; |
169 | 169 |
170 m_preflightHashMap.remove(cacheIt); | 170 m_preflightHashMap.remove(cacheIt); |
171 return false; | 171 return false; |
172 } | 172 } |
173 | 173 |
174 } // namespace blink | 174 } // namespace blink |
OLD | NEW |