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/http/http_stream_factory_impl_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 } | 645 } |
646 return ERR_UNSAFE_PORT; | 646 return ERR_UNSAFE_PORT; |
647 } | 647 } |
648 | 648 |
649 next_state_ = STATE_RESOLVE_PROXY; | 649 next_state_ = STATE_RESOLVE_PROXY; |
650 return OK; | 650 return OK; |
651 } | 651 } |
652 | 652 |
653 int HttpStreamFactoryImpl::Job::DoResolveProxy() { | 653 int HttpStreamFactoryImpl::Job::DoResolveProxy() { |
654 DCHECK(!pac_request_); | 654 DCHECK(!pac_request_); |
| 655 DCHECK(session_); |
655 | 656 |
656 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; | 657 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; |
657 | 658 |
658 if (request_info_.load_flags & LOAD_BYPASS_PROXY) { | 659 if (request_info_.load_flags & LOAD_BYPASS_PROXY) { |
659 proxy_info_.UseDirect(); | 660 proxy_info_.UseDirect(); |
660 return OK; | 661 return OK; |
661 } | 662 } |
662 | 663 |
663 return session_->proxy_service()->ResolveProxy( | 664 return session_->proxy_service()->ResolveProxy( |
664 request_info_.url, &proxy_info_, io_callback_, &pac_request_, net_log_); | 665 request_info_.url, request_info_.load_flags, &proxy_info_, io_callback_, |
| 666 &pac_request_, session_->network_delegate(), net_log_); |
665 } | 667 } |
666 | 668 |
667 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 669 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
668 pac_request_ = NULL; | 670 pac_request_ = NULL; |
669 | 671 |
670 if (result == OK) { | 672 if (result == OK) { |
671 // Remove unsupported proxies from the list. | 673 // Remove unsupported proxies from the list. |
672 proxy_info_.RemoveProxiesWithoutScheme( | 674 proxy_info_.RemoveProxiesWithoutScheme( |
673 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_QUIC | | 675 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_QUIC | |
674 ProxyServer::SCHEME_HTTP | ProxyServer::SCHEME_HTTPS | | 676 ProxyServer::SCHEME_HTTP | ProxyServer::SCHEME_HTTPS | |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 ssl_config->verify_ev_cert = true; | 1263 ssl_config->verify_ev_cert = true; |
1262 | 1264 |
1263 // Disable Channel ID if privacy mode is enabled. | 1265 // Disable Channel ID if privacy mode is enabled. |
1264 if (request_info_.privacy_mode == PRIVACY_MODE_ENABLED) | 1266 if (request_info_.privacy_mode == PRIVACY_MODE_ENABLED) |
1265 ssl_config->channel_id_enabled = false; | 1267 ssl_config->channel_id_enabled = false; |
1266 } | 1268 } |
1267 | 1269 |
1268 | 1270 |
1269 int HttpStreamFactoryImpl::Job::ReconsiderProxyAfterError(int error) { | 1271 int HttpStreamFactoryImpl::Job::ReconsiderProxyAfterError(int error) { |
1270 DCHECK(!pac_request_); | 1272 DCHECK(!pac_request_); |
| 1273 DCHECK(session_); |
1271 | 1274 |
1272 // A failure to resolve the hostname or any error related to establishing a | 1275 // A failure to resolve the hostname or any error related to establishing a |
1273 // TCP connection could be grounds for trying a new proxy configuration. | 1276 // TCP connection could be grounds for trying a new proxy configuration. |
1274 // | 1277 // |
1275 // Why do this when a hostname cannot be resolved? Some URLs only make sense | 1278 // Why do this when a hostname cannot be resolved? Some URLs only make sense |
1276 // to proxy servers. The hostname in those URLs might fail to resolve if we | 1279 // to proxy servers. The hostname in those URLs might fail to resolve if we |
1277 // are still using a non-proxy config. We need to check if a proxy config | 1280 // are still using a non-proxy config. We need to check if a proxy config |
1278 // now exists that corresponds to a proxy server that could load the URL. | 1281 // now exists that corresponds to a proxy server that could load the URL. |
1279 // | 1282 // |
1280 switch (error) { | 1283 switch (error) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 if (request_info_.load_flags & LOAD_BYPASS_PROXY) { | 1317 if (request_info_.load_flags & LOAD_BYPASS_PROXY) { |
1315 return error; | 1318 return error; |
1316 } | 1319 } |
1317 | 1320 |
1318 if (proxy_info_.is_https() && proxy_ssl_config_.send_client_cert) { | 1321 if (proxy_info_.is_https() && proxy_ssl_config_.send_client_cert) { |
1319 session_->ssl_client_auth_cache()->Remove( | 1322 session_->ssl_client_auth_cache()->Remove( |
1320 proxy_info_.proxy_server().host_port_pair()); | 1323 proxy_info_.proxy_server().host_port_pair()); |
1321 } | 1324 } |
1322 | 1325 |
1323 int rv = session_->proxy_service()->ReconsiderProxyAfterError( | 1326 int rv = session_->proxy_service()->ReconsiderProxyAfterError( |
1324 request_info_.url, error, &proxy_info_, io_callback_, &pac_request_, | 1327 request_info_.url, request_info_.load_flags, error, &proxy_info_, |
1325 net_log_); | 1328 io_callback_, &pac_request_, session_->network_delegate(), net_log_); |
1326 if (rv == OK || rv == ERR_IO_PENDING) { | 1329 if (rv == OK || rv == ERR_IO_PENDING) { |
1327 // If the error was during connection setup, there is no socket to | 1330 // If the error was during connection setup, there is no socket to |
1328 // disconnect. | 1331 // disconnect. |
1329 if (connection_->socket()) | 1332 if (connection_->socket()) |
1330 connection_->socket()->Disconnect(); | 1333 connection_->socket()->Disconnect(); |
1331 connection_->Reset(); | 1334 connection_->Reset(); |
1332 if (request_) | 1335 if (request_) |
1333 request_->RemoveRequestFromSpdySessionRequestMap(); | 1336 request_->RemoveRequestFromSpdySessionRequestMap(); |
1334 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; | 1337 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; |
1335 } else { | 1338 } else { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 | 1476 |
1474 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1477 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
1475 HistogramBrokenAlternateProtocolLocation( | 1478 HistogramBrokenAlternateProtocolLocation( |
1476 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1479 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
1477 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1480 session_->http_server_properties()->SetBrokenAlternateProtocol( |
1478 HostPortPair::FromURL(request_info_.url)); | 1481 HostPortPair::FromURL(request_info_.url)); |
1479 } | 1482 } |
1480 } | 1483 } |
1481 | 1484 |
1482 } // namespace net | 1485 } // namespace net |
OLD | NEW |