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" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "net/base/data_url.h" | 12 #include "net/base/data_url.h" |
13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
14 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/base/request_priority.h" |
16 #include "net/cert/cert_status_flags.h" | 17 #include "net/cert/cert_status_flags.h" |
17 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
18 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
19 | 20 |
20 // TODO(eroman): | 21 // TODO(eroman): |
21 // - Support auth-prompts (http://crbug.com/77366) | 22 // - Support auth-prompts (http://crbug.com/77366) |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 | 25 |
25 namespace { | 26 namespace { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 std::string mime_type; | 127 std::string mime_type; |
127 std::string charset; | 128 std::string charset; |
128 std::string data; | 129 std::string data; |
129 if (!DataURL::Parse(url, &mime_type, &charset, &data)) | 130 if (!DataURL::Parse(url, &mime_type, &charset, &data)) |
130 return ERR_FAILED; | 131 return ERR_FAILED; |
131 | 132 |
132 ConvertResponseToUTF16(charset, data, text); | 133 ConvertResponseToUTF16(charset, data, text); |
133 return OK; | 134 return OK; |
134 } | 135 } |
135 | 136 |
136 cur_request_.reset(url_request_context_->CreateRequest(url, this)); | 137 cur_request_ = |
| 138 url_request_context_->CreateRequest(url, DEFAULT_PRIORITY, this); |
137 cur_request_->set_method("GET"); | 139 cur_request_->set_method("GET"); |
138 | 140 |
139 // Make sure that the PAC script is downloaded using a direct connection, | 141 // Make sure that the PAC script is downloaded using a direct connection, |
140 // to avoid circular dependencies (fetching is a part of proxy resolution). | 142 // to avoid circular dependencies (fetching is a part of proxy resolution). |
141 // Also disable the use of the disk cache. The cache is disabled so that if | 143 // Also disable the use of the disk cache. The cache is disabled so that if |
142 // the user switches networks we don't potentially use the cached response | 144 // the user switches networks we don't potentially use the cached response |
143 // from old network when we should in fact be re-fetching on the new network. | 145 // from old network when we should in fact be re-fetching on the new network. |
144 // If the PAC script is hosted on an HTTPS server we bypass revocation | 146 // If the PAC script is hosted on an HTTPS server we bypass revocation |
145 // checking in order to avoid a circular dependency when attempting to fetch | 147 // checking in order to avoid a circular dependency when attempting to fetch |
146 // the OCSP response or CRL. We could make the revocation check go direct but | 148 // the OCSP response or CRL. We could make the revocation check go direct but |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // is still applicable. | 314 // is still applicable. |
313 if (cur_request_id_ != id) | 315 if (cur_request_id_ != id) |
314 return; | 316 return; |
315 | 317 |
316 DCHECK(cur_request_.get()); | 318 DCHECK(cur_request_.get()); |
317 result_code_ = ERR_TIMED_OUT; | 319 result_code_ = ERR_TIMED_OUT; |
318 cur_request_->Cancel(); | 320 cur_request_->Cancel(); |
319 } | 321 } |
320 | 322 |
321 } // namespace net | 323 } // namespace net |
OLD | NEW |