| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) | 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newURL)); | 129 didFail(nullptr, ResourceError::cancelledDueToAccessCheckError(newURL)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool ResourceLoader::willFollowRedirect( | 132 bool ResourceLoader::willFollowRedirect( |
| 133 WebURLLoader*, | 133 WebURLLoader*, |
| 134 WebURLRequest& passedNewRequest, | 134 WebURLRequest& passedNewRequest, |
| 135 const WebURLResponse& passedRedirectResponse) { | 135 const WebURLResponse& passedRedirectResponse) { |
| 136 DCHECK(!passedNewRequest.isNull()); | 136 DCHECK(!passedNewRequest.isNull()); |
| 137 DCHECK(!passedRedirectResponse.isNull()); | 137 DCHECK(!passedRedirectResponse.isNull()); |
| 138 | 138 |
| 139 if (m_resource->resourceRequest().isCacheAwareLoadingActivated()) { |
| 140 // Reload with original request if cached response is a redirection. |
| 141 ResourceError error; |
| 142 error.setIsCacheMiss(true); |
| 143 didFail(nullptr, error); |
| 144 return false; |
| 145 } |
| 146 |
| 139 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); | 147 ResourceRequest& newRequest(passedNewRequest.toMutableResourceRequest()); |
| 140 const ResourceResponse& redirectResponse( | 148 const ResourceResponse& redirectResponse( |
| 141 passedRedirectResponse.toResourceResponse()); | 149 passedRedirectResponse.toResourceResponse()); |
| 142 newRequest.setRedirectStatus( | 150 newRequest.setRedirectStatus( |
| 143 ResourceRequest::RedirectStatus::FollowedRedirect); | 151 ResourceRequest::RedirectStatus::FollowedRedirect); |
| 144 | 152 |
| 145 const KURL originalURL = newRequest.url(); | 153 const KURL originalURL = newRequest.url(); |
| 146 | 154 |
| 147 if (!m_fetcher->willFollowRedirect(m_resource.get(), newRequest, | 155 if (!m_fetcher->willFollowRedirect(m_resource.get(), newRequest, |
| 148 redirectResponse)) { | 156 redirectResponse)) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // a 304, where it will overwrite the cached data we should be reusing. | 266 // a 304, where it will overwrite the cached data we should be reusing. |
| 259 if (dataOut.size()) { | 267 if (dataOut.size()) { |
| 260 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size(), | 268 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size(), |
| 261 encodedDataLength); | 269 encodedDataLength); |
| 262 m_resource->setResourceBuffer(dataOut); | 270 m_resource->setResourceBuffer(dataOut); |
| 263 } | 271 } |
| 264 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 272 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
| 265 } | 273 } |
| 266 | 274 |
| 267 } // namespace blink | 275 } // namespace blink |
| OLD | NEW |