Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: net/proxy/proxy_script_fetcher_impl.cc

Issue 2845643003: Allow ProxyService to share URLRequestContext with everything else. (Closed)
Patch Set: Fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (!DataURL::Parse(url, &mime_type, &charset, &data)) 131 if (!DataURL::Parse(url, &mime_type, &charset, &data))
132 return ERR_FAILED; 132 return ERR_FAILED;
133 133
134 ConvertResponseToUTF16(charset, data, text); 134 ConvertResponseToUTF16(charset, data, text);
135 return OK; 135 return OK;
136 } 136 }
137 137
138 DCHECK(fetch_start_time_.is_null()); 138 DCHECK(fetch_start_time_.is_null());
139 fetch_start_time_ = base::TimeTicks::Now(); 139 fetch_start_time_ = base::TimeTicks::Now();
140 140
141 // Use highest priority, so if socket pools are being used for other types of
142 // requests, PAC requests are aren't blocked on them.
141 cur_request_ = 143 cur_request_ =
142 url_request_context_->CreateRequest(url, DEFAULT_PRIORITY, this); 144 url_request_context_->CreateRequest(url, MAXIMUM_PRIORITY, this);
143 cur_request_->set_method("GET"); 145 cur_request_->set_method("GET");
144 146
145 // Make sure that the PAC script is downloaded using a direct connection, 147 // Make sure that the PAC script is downloaded using a direct connection,
146 // to avoid circular dependencies (fetching is a part of proxy resolution). 148 // to avoid circular dependencies (fetching is a part of proxy resolution).
147 // Also disable the use of the disk cache. The cache is disabled so that if 149 // Also disable the use of the disk cache. The cache is disabled so that if
148 // the user switches networks we don't potentially use the cached response 150 // the user switches networks we don't potentially use the cached response
149 // from old network when we should in fact be re-fetching on the new network. 151 // from old network when we should in fact be re-fetching on the new network.
150 // If the PAC script is hosted on an HTTPS server we bypass revocation 152 // If the PAC script is hosted on an HTTPS server we bypass revocation
151 // checking in order to avoid a circular dependency when attempting to fetch 153 // checking in order to avoid a circular dependency when attempting to fetch
152 // the OCSP response or CRL. We could make the revocation check go direct but 154 // the OCSP response or CRL. We could make the revocation check go direct but
153 // the proxy might be the only way to the outside world. 155 // the proxy might be the only way to the outside world. IGNORE_LIMITS is
156 // used to avoid blocking proxy resolution on other network requests.
154 cur_request_->SetLoadFlags(LOAD_BYPASS_PROXY | LOAD_DISABLE_CACHE | 157 cur_request_->SetLoadFlags(LOAD_BYPASS_PROXY | LOAD_DISABLE_CACHE |
155 LOAD_DISABLE_CERT_REVOCATION_CHECKING); 158 LOAD_DISABLE_CERT_REVOCATION_CHECKING |
159 LOAD_IGNORE_LIMITS);
156 160
157 // Save the caller's info for notification on completion. 161 // Save the caller's info for notification on completion.
158 callback_ = callback; 162 callback_ = callback;
159 result_text_ = text; 163 result_text_ = text;
160 164
161 bytes_read_so_far_.clear(); 165 bytes_read_so_far_.clear();
162 166
163 // Post a task to timeout this request if it takes too long. 167 // Post a task to timeout this request if it takes too long.
164 cur_request_id_ = ++next_id_; 168 cur_request_id_ = ++next_id_;
165 169
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // is still applicable. 342 // is still applicable.
339 if (cur_request_id_ != id) 343 if (cur_request_id_ != id)
340 return; 344 return;
341 345
342 DCHECK(cur_request_.get()); 346 DCHECK(cur_request_.get());
343 result_code_ = ERR_TIMED_OUT; 347 result_code_ = ERR_TIMED_OUT;
344 cur_request_->Cancel(); 348 cur_request_->Cancel();
345 } 349 }
346 350
347 } // namespace net 351 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_script_fetcher_impl_unittest.cc » ('j') | net/proxy/proxy_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698