| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google 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 #include "core/fetch/RawResource.h" | 26 #include "core/fetch/RawResource.h" |
| 27 | 27 |
| 28 #include "core/fetch/FetchRequest.h" | 28 #include "core/fetch/FetchRequest.h" |
| 29 #include "core/fetch/MemoryCache.h" | 29 #include "core/fetch/MemoryCache.h" |
| 30 #include "core/fetch/ResourceClientOrObserverWalker.h" | 30 #include "core/fetch/ResourceClientOrObserverWalker.h" |
| 31 #include "core/fetch/ResourceFetcher.h" | 31 #include "core/fetch/ResourceFetcher.h" |
| 32 #include "core/fetch/ResourceLoader.h" | 32 #include "core/fetch/ResourceLoader.h" |
| 33 #include "platform/HTTPNames.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 Resource* RawResource::fetchSynchronously(FetchRequest& request, ResourceFetcher
* fetcher) | 37 Resource* RawResource::fetchSynchronously(FetchRequest& request, ResourceFetcher
* fetcher) |
| 37 { | 38 { |
| 38 request.mutableResourceRequest().setTimeoutInterval(10); | 39 request.mutableResourceRequest().setTimeoutInterval(10); |
| 39 ResourceLoaderOptions options(request.options()); | 40 ResourceLoaderOptions options(request.options()); |
| 40 options.synchronousPolicy = RequestSynchronously; | 41 options.synchronousPolicy = RequestSynchronously; |
| 41 request.setOptions(options); | 42 request.setOptions(options); |
| 42 return fetcher->requestResource(request, RawResourceFactory(Resource::Raw)); | 43 return fetcher->requestResource(request, RawResourceFactory(Resource::Raw)); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, m_headers, ()); | 206 DEFINE_STATIC_LOCAL(HashSet<AtomicString>, m_headers, ()); |
| 206 if (m_headers.isEmpty()) { | 207 if (m_headers.isEmpty()) { |
| 207 m_headers.add("Cache-Control"); | 208 m_headers.add("Cache-Control"); |
| 208 m_headers.add("If-Modified-Since"); | 209 m_headers.add("If-Modified-Since"); |
| 209 m_headers.add("If-None-Match"); | 210 m_headers.add("If-None-Match"); |
| 210 m_headers.add("Origin"); | 211 m_headers.add("Origin"); |
| 211 m_headers.add("Pragma"); | 212 m_headers.add("Pragma"); |
| 212 m_headers.add("Purpose"); | 213 m_headers.add("Purpose"); |
| 213 m_headers.add("Referer"); | 214 m_headers.add("Referer"); |
| 214 m_headers.add("User-Agent"); | 215 m_headers.add("User-Agent"); |
| 216 m_headers.add(HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id
); |
| 215 } | 217 } |
| 216 return m_headers.contains(headerName); | 218 return m_headers.contains(headerName); |
| 217 } | 219 } |
| 218 | 220 |
| 219 static bool isCacheableHTTPMethod(const AtomicString& method) | 221 static bool isCacheableHTTPMethod(const AtomicString& method) |
| 220 { | 222 { |
| 221 // Per http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.10, | 223 // Per http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.10, |
| 222 // these methods always invalidate the cache entry. | 224 // these methods always invalidate the cache entry. |
| 223 return method != "POST" && method != "PUT" && method != "DELETE"; | 225 return method != "POST" && method != "PUT" && method != "DELETE"; |
| 224 } | 226 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 255 for (const auto& header : oldHeaders) { | 257 for (const auto& header : oldHeaders) { |
| 256 AtomicString headerName = header.key; | 258 AtomicString headerName = header.key; |
| 257 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH
eaders.get(headerName)) | 259 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH
eaders.get(headerName)) |
| 258 return false; | 260 return false; |
| 259 } | 261 } |
| 260 | 262 |
| 261 return true; | 263 return true; |
| 262 } | 264 } |
| 263 | 265 |
| 264 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |