OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 10 #include "base/message_loop.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "net/base/cert_status_flags.h" |
12 #include "net/base/data_url.h" | 13 #include "net/base/data_url.h" |
13 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
14 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
15 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
16 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
17 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
18 | 19 |
19 // TODO(eroman): | 20 // TODO(eroman): |
20 // - Support auth-prompts (http://crbug.com/77366) | 21 // - Support auth-prompts (http://crbug.com/77366) |
21 | 22 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void ProxyScriptFetcherImpl::OnAuthRequired(URLRequest* request, | 184 void ProxyScriptFetcherImpl::OnAuthRequired(URLRequest* request, |
184 AuthChallengeInfo* auth_info) { | 185 AuthChallengeInfo* auth_info) { |
185 DCHECK_EQ(request, cur_request_.get()); | 186 DCHECK_EQ(request, cur_request_.get()); |
186 // TODO(eroman): http://crbug.com/77366 | 187 // TODO(eroman): http://crbug.com/77366 |
187 LOG(WARNING) << "Auth required to fetch PAC script, aborting."; | 188 LOG(WARNING) << "Auth required to fetch PAC script, aborting."; |
188 result_code_ = ERR_NOT_IMPLEMENTED; | 189 result_code_ = ERR_NOT_IMPLEMENTED; |
189 request->CancelAuth(); | 190 request->CancelAuth(); |
190 } | 191 } |
191 | 192 |
192 void ProxyScriptFetcherImpl::OnSSLCertificateError(URLRequest* request, | 193 void ProxyScriptFetcherImpl::OnSSLCertificateError(URLRequest* request, |
193 int cert_error, | 194 const SSLInfo& ssl_info, |
194 X509Certificate* cert) { | 195 bool is_hsts_host) { |
195 DCHECK_EQ(request, cur_request_.get()); | 196 DCHECK_EQ(request, cur_request_.get()); |
196 LOG(WARNING) << "SSL certificate error when fetching PAC script, aborting."; | 197 LOG(WARNING) << "SSL certificate error when fetching PAC script, aborting."; |
197 // Certificate errors are in same space as net errors. | 198 // Certificate errors are in same space as net errors. |
198 result_code_ = cert_error; | 199 result_code_ = MapCertStatusToNetError(ssl_info.cert_status); |
199 request->Cancel(); | 200 request->Cancel(); |
200 } | 201 } |
201 | 202 |
202 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) { | 203 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) { |
203 DCHECK_EQ(request, cur_request_.get()); | 204 DCHECK_EQ(request, cur_request_.get()); |
204 | 205 |
205 if (!request->status().is_success()) { | 206 if (!request->status().is_success()) { |
206 OnResponseCompleted(request); | 207 OnResponseCompleted(request); |
207 return; | 208 return; |
208 } | 209 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // is still applicable. | 313 // is still applicable. |
313 if (cur_request_id_ != id) | 314 if (cur_request_id_ != id) |
314 return; | 315 return; |
315 | 316 |
316 DCHECK(cur_request_.get()); | 317 DCHECK(cur_request_.get()); |
317 result_code_ = ERR_TIMED_OUT; | 318 result_code_ = ERR_TIMED_OUT; |
318 cur_request_->Cancel(); | 319 cur_request_->Cancel(); |
319 } | 320 } |
320 | 321 |
321 } // namespace net | 322 } // namespace net |
OLD | NEW |