| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 // for the proxy to use to reach the original URL via TCP. But | 805 // for the proxy to use to reach the original URL via TCP. But |
| 806 // the alternate request will be going via UDP to a different port. | 806 // the alternate request will be going via UDP to a different port. |
| 807 GURL::Replacements replacements; | 807 GURL::Replacements replacements; |
| 808 // new_port needs to be in scope here because GURL::Replacements references | 808 // new_port needs to be in scope here because GURL::Replacements references |
| 809 // the memory contained by it directly. | 809 // the memory contained by it directly. |
| 810 const std::string new_port = base::UintToString(alternative_service_.port); | 810 const std::string new_port = base::UintToString(alternative_service_.port); |
| 811 replacements.SetSchemeStr("https"); | 811 replacements.SetSchemeStr("https"); |
| 812 replacements.SetPortStr(new_port); | 812 replacements.SetPortStr(new_port); |
| 813 url_for_proxy = url_for_proxy.ReplaceComponents(replacements); | 813 url_for_proxy = url_for_proxy.ReplaceComponents(replacements); |
| 814 } | 814 } |
| 815 |
| 815 return session_->proxy_service()->ResolveProxy( | 816 return session_->proxy_service()->ResolveProxy( |
| 816 url_for_proxy, request_info_.load_flags, &proxy_info_, io_callback_, | 817 url_for_proxy, request_info_.load_flags, &proxy_info_, io_callback_, |
| 817 &pac_request_, session_->params().proxy_delegate, net_log_); | 818 &pac_request_, session_->network_delegate(), net_log_); |
| 818 } | 819 } |
| 819 | 820 |
| 820 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 821 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
| 821 pac_request_ = NULL; | 822 pac_request_ = NULL; |
| 822 | 823 |
| 823 if (result == OK) { | 824 if (result == OK) { |
| 824 // Remove unsupported proxies from the list. | 825 // Remove unsupported proxies from the list. |
| 825 int supported_proxies = | 826 int supported_proxies = |
| 826 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | | 827 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | |
| 827 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | | 828 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 // bubble up to the request. | 1367 // bubble up to the request. |
| 1367 return SetSpdyHttpStreamOrBidirectionalStreamJob(new_spdy_session_, | 1368 return SetSpdyHttpStreamOrBidirectionalStreamJob(new_spdy_session_, |
| 1368 spdy_session_direct_); | 1369 spdy_session_direct_); |
| 1369 } | 1370 } |
| 1370 | 1371 |
| 1371 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { | 1372 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { |
| 1372 if (result < 0) | 1373 if (result < 0) |
| 1373 return result; | 1374 return result; |
| 1374 | 1375 |
| 1375 session_->proxy_service()->ReportSuccess(proxy_info_, | 1376 session_->proxy_service()->ReportSuccess(proxy_info_, |
| 1376 session_->params().proxy_delegate); | 1377 session_->network_delegate()); |
| 1377 next_state_ = STATE_NONE; | 1378 next_state_ = STATE_NONE; |
| 1378 return OK; | 1379 return OK; |
| 1379 } | 1380 } |
| 1380 | 1381 |
| 1381 int HttpStreamFactoryImpl::Job::DoRestartTunnelAuth() { | 1382 int HttpStreamFactoryImpl::Job::DoRestartTunnelAuth() { |
| 1382 next_state_ = STATE_RESTART_TUNNEL_AUTH_COMPLETE; | 1383 next_state_ = STATE_RESTART_TUNNEL_AUTH_COMPLETE; |
| 1383 ProxyClientSocket* proxy_socket = | 1384 ProxyClientSocket* proxy_socket = |
| 1384 static_cast<ProxyClientSocket*>(connection_->socket()); | 1385 static_cast<ProxyClientSocket*>(connection_->socket()); |
| 1385 return proxy_socket->RestartWithAuth(io_callback_); | 1386 return proxy_socket->RestartWithAuth(io_callback_); |
| 1386 } | 1387 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 if (request_info_.load_flags & LOAD_BYPASS_PROXY) | 1540 if (request_info_.load_flags & LOAD_BYPASS_PROXY) |
| 1540 return error; | 1541 return error; |
| 1541 | 1542 |
| 1542 if (proxy_info_.is_https() && proxy_ssl_config_.send_client_cert) { | 1543 if (proxy_info_.is_https() && proxy_ssl_config_.send_client_cert) { |
| 1543 session_->ssl_client_auth_cache()->Remove( | 1544 session_->ssl_client_auth_cache()->Remove( |
| 1544 proxy_info_.proxy_server().host_port_pair()); | 1545 proxy_info_.proxy_server().host_port_pair()); |
| 1545 } | 1546 } |
| 1546 | 1547 |
| 1547 int rv = session_->proxy_service()->ReconsiderProxyAfterError( | 1548 int rv = session_->proxy_service()->ReconsiderProxyAfterError( |
| 1548 request_info_.url, request_info_.load_flags, error, &proxy_info_, | 1549 request_info_.url, request_info_.load_flags, error, &proxy_info_, |
| 1549 io_callback_, &pac_request_, session_->params().proxy_delegate, net_log_); | 1550 io_callback_, &pac_request_, session_->network_delegate(), net_log_); |
| 1550 if (rv == OK || rv == ERR_IO_PENDING) { | 1551 if (rv == OK || rv == ERR_IO_PENDING) { |
| 1551 // If the error was during connection setup, there is no socket to | 1552 // If the error was during connection setup, there is no socket to |
| 1552 // disconnect. | 1553 // disconnect. |
| 1553 if (connection_->socket()) | 1554 if (connection_->socket()) |
| 1554 connection_->socket()->Disconnect(); | 1555 connection_->socket()->Disconnect(); |
| 1555 connection_->Reset(); | 1556 connection_->Reset(); |
| 1556 if (request_) | 1557 if (request_) |
| 1557 request_->RemoveRequestFromSpdySessionRequestMap(); | 1558 request_->RemoveRequestFromSpdySessionRequestMap(); |
| 1558 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; | 1559 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; |
| 1559 } else { | 1560 } else { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 if (connection_->socket()) { | 1725 if (connection_->socket()) { |
| 1725 ConnectionAttempts socket_attempts; | 1726 ConnectionAttempts socket_attempts; |
| 1726 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1727 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1727 request_->AddConnectionAttempts(socket_attempts); | 1728 request_->AddConnectionAttempts(socket_attempts); |
| 1728 } else { | 1729 } else { |
| 1729 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1730 request_->AddConnectionAttempts(connection_->connection_attempts()); |
| 1730 } | 1731 } |
| 1731 } | 1732 } |
| 1732 | 1733 |
| 1733 } // namespace net | 1734 } // namespace net |
| OLD | NEW |