| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/proxy/proxy_script_fetcher_impl.h" | 5 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // Make sure that the PAC script is downloaded using a direct connection, | 140 // Make sure that the PAC script is downloaded using a direct connection, |
| 141 // to avoid circular dependencies (fetching is a part of proxy resolution). | 141 // to avoid circular dependencies (fetching is a part of proxy resolution). |
| 142 // Also disable the use of the disk cache. The cache is disabled so that if | 142 // Also disable the use of the disk cache. The cache is disabled so that if |
| 143 // the user switches networks we don't potentially use the cached response | 143 // the user switches networks we don't potentially use the cached response |
| 144 // from old network when we should in fact be re-fetching on the new network. | 144 // from old network when we should in fact be re-fetching on the new network. |
| 145 // If the PAC script is hosted on an HTTPS server we bypass revocation | 145 // If the PAC script is hosted on an HTTPS server we bypass revocation |
| 146 // checking in order to avoid a circular dependency when attempting to fetch | 146 // checking in order to avoid a circular dependency when attempting to fetch |
| 147 // the OCSP response or CRL. We could make the revocation check go direct but | 147 // the OCSP response or CRL. We could make the revocation check go direct but |
| 148 // the proxy might be the only way to the outside world. | 148 // the proxy might be the only way to the outside world. |
| 149 cur_request_->set_load_flags(LOAD_BYPASS_PROXY | LOAD_DISABLE_CACHE | | 149 cur_request_->SetLoadFlags(LOAD_BYPASS_PROXY | LOAD_DISABLE_CACHE | |
| 150 LOAD_DISABLE_CERT_REVOCATION_CHECKING); | 150 LOAD_DISABLE_CERT_REVOCATION_CHECKING); |
| 151 | 151 |
| 152 // Save the caller's info for notification on completion. | 152 // Save the caller's info for notification on completion. |
| 153 callback_ = callback; | 153 callback_ = callback; |
| 154 result_text_ = text; | 154 result_text_ = text; |
| 155 | 155 |
| 156 bytes_read_so_far_.clear(); | 156 bytes_read_so_far_.clear(); |
| 157 | 157 |
| 158 // Post a task to timeout this request if it takes too long. | 158 // Post a task to timeout this request if it takes too long. |
| 159 cur_request_id_ = ++next_id_; | 159 cur_request_id_ = ++next_id_; |
| 160 base::MessageLoop::current()->PostDelayedTask( | 160 base::MessageLoop::current()->PostDelayedTask( |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // is still applicable. | 313 // is still applicable. |
| 314 if (cur_request_id_ != id) | 314 if (cur_request_id_ != id) |
| 315 return; | 315 return; |
| 316 | 316 |
| 317 DCHECK(cur_request_.get()); | 317 DCHECK(cur_request_.get()); |
| 318 result_code_ = ERR_TIMED_OUT; | 318 result_code_ = ERR_TIMED_OUT; |
| 319 cur_request_->Cancel(); | 319 cur_request_->Cancel(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 } // namespace net | 322 } // namespace net |
| OLD | NEW |