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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 } | 778 } |
779 | 779 |
780 // If an alternative proxy server was provided, use that. | 780 // If an alternative proxy server was provided, use that. |
781 if (alternative_proxy_server_.is_valid()) { | 781 if (alternative_proxy_server_.is_valid()) { |
782 proxy_info_.UseProxyServer(alternative_proxy_server_); | 782 proxy_info_.UseProxyServer(alternative_proxy_server_); |
783 return OK; | 783 return OK; |
784 } | 784 } |
785 | 785 |
786 return session_->proxy_service()->ResolveProxy( | 786 return session_->proxy_service()->ResolveProxy( |
787 origin_url_, request_info_.method, &proxy_info_, io_callback_, | 787 origin_url_, request_info_.method, &proxy_info_, io_callback_, |
788 &pac_request_, session_->params().proxy_delegate, net_log_); | 788 &pac_request_, session_->context().proxy_delegate, net_log_); |
789 } | 789 } |
790 | 790 |
791 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 791 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
792 pac_request_ = NULL; | 792 pac_request_ = NULL; |
793 | 793 |
794 net_log_.AddEvent( | 794 net_log_.AddEvent( |
795 NetLogEventType::HTTP_STREAM_JOB_PROXY_SERVER_RESOLVED, | 795 NetLogEventType::HTTP_STREAM_JOB_PROXY_SERVER_RESOLVED, |
796 base::Bind( | 796 base::Bind( |
797 &NetLogHttpStreamJobProxyServerResolved, | 797 &NetLogHttpStreamJobProxyServerResolved, |
798 proxy_info_.is_empty() ? ProxyServer() : proxy_info_.proxy_server())); | 798 proxy_info_.is_empty() ? ProxyServer() : proxy_info_.proxy_server())); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1206 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
1207 "462811 HttpStreamFactoryImpl::Job::DoCreateStream")); | 1207 "462811 HttpStreamFactoryImpl::Job::DoCreateStream")); |
1208 DCHECK(connection_->socket() || existing_spdy_session_.get() || using_quic_); | 1208 DCHECK(connection_->socket() || existing_spdy_session_.get() || using_quic_); |
1209 DCHECK(!IsQuicAlternative()); | 1209 DCHECK(!IsQuicAlternative()); |
1210 | 1210 |
1211 next_state_ = STATE_CREATE_STREAM_COMPLETE; | 1211 next_state_ = STATE_CREATE_STREAM_COMPLETE; |
1212 | 1212 |
1213 if (using_ssl_ && connection_->socket()) { | 1213 if (using_ssl_ && connection_->socket()) { |
1214 SSLClientSocket* ssl_socket = | 1214 SSLClientSocket* ssl_socket = |
1215 static_cast<SSLClientSocket*>(connection_->socket()); | 1215 static_cast<SSLClientSocket*>(connection_->socket()); |
1216 RecordChannelIDKeyMatch(ssl_socket, session_->params().channel_id_service, | 1216 RecordChannelIDKeyMatch(ssl_socket, session_->context().channel_id_service, |
1217 destination_.HostForURL()); | 1217 destination_.HostForURL()); |
1218 } | 1218 } |
1219 | 1219 |
1220 // We only set the socket motivation if we're the first to use | 1220 // We only set the socket motivation if we're the first to use |
1221 // this socket. Is there a race for two SPDY requests? We really | 1221 // this socket. Is there a race for two SPDY requests? We really |
1222 // need to plumb this through to the connect level. | 1222 // need to plumb this through to the connect level. |
1223 if (connection_->socket() && !connection_->is_reused()) | 1223 if (connection_->socket() && !connection_->is_reused()) |
1224 SetSocketMotivation(); | 1224 SetSocketMotivation(); |
1225 | 1225 |
1226 if (!using_spdy_) { | 1226 if (!using_spdy_) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 // bubble up to the request. | 1298 // bubble up to the request. |
1299 return SetSpdyHttpStreamOrBidirectionalStreamImpl(new_spdy_session_, | 1299 return SetSpdyHttpStreamOrBidirectionalStreamImpl(new_spdy_session_, |
1300 spdy_session_direct_); | 1300 spdy_session_direct_); |
1301 } | 1301 } |
1302 | 1302 |
1303 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { | 1303 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { |
1304 if (result < 0) | 1304 if (result < 0) |
1305 return result; | 1305 return result; |
1306 | 1306 |
1307 session_->proxy_service()->ReportSuccess(proxy_info_, | 1307 session_->proxy_service()->ReportSuccess(proxy_info_, |
1308 session_->params().proxy_delegate); | 1308 session_->context().proxy_delegate); |
1309 next_state_ = STATE_NONE; | 1309 next_state_ = STATE_NONE; |
1310 return OK; | 1310 return OK; |
1311 } | 1311 } |
1312 | 1312 |
1313 int HttpStreamFactoryImpl::Job::DoRestartTunnelAuth() { | 1313 int HttpStreamFactoryImpl::Job::DoRestartTunnelAuth() { |
1314 next_state_ = STATE_RESTART_TUNNEL_AUTH_COMPLETE; | 1314 next_state_ = STATE_RESTART_TUNNEL_AUTH_COMPLETE; |
1315 ProxyClientSocket* proxy_socket = | 1315 ProxyClientSocket* proxy_socket = |
1316 static_cast<ProxyClientSocket*>(connection_->socket()); | 1316 static_cast<ProxyClientSocket*>(connection_->socket()); |
1317 return proxy_socket->RestartWithAuth(io_callback_); | 1317 return proxy_socket->RestartWithAuth(io_callback_); |
1318 } | 1318 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 return error; | 1478 return error; |
1479 } | 1479 } |
1480 | 1480 |
1481 if (proxy_info_.is_https() && proxy_ssl_config_.send_client_cert) { | 1481 if (proxy_info_.is_https() && proxy_ssl_config_.send_client_cert) { |
1482 session_->ssl_client_auth_cache()->Remove( | 1482 session_->ssl_client_auth_cache()->Remove( |
1483 proxy_info_.proxy_server().host_port_pair()); | 1483 proxy_info_.proxy_server().host_port_pair()); |
1484 } | 1484 } |
1485 | 1485 |
1486 int rv = session_->proxy_service()->ReconsiderProxyAfterError( | 1486 int rv = session_->proxy_service()->ReconsiderProxyAfterError( |
1487 request_info_.url, request_info_.method, error, &proxy_info_, | 1487 request_info_.url, request_info_.method, error, &proxy_info_, |
1488 io_callback_, &pac_request_, session_->params().proxy_delegate, net_log_); | 1488 io_callback_, &pac_request_, session_->context().proxy_delegate, |
| 1489 net_log_); |
1489 if (rv == OK || rv == ERR_IO_PENDING) { | 1490 if (rv == OK || rv == ERR_IO_PENDING) { |
1490 // If the error was during connection setup, there is no socket to | 1491 // If the error was during connection setup, there is no socket to |
1491 // disconnect. | 1492 // disconnect. |
1492 if (connection_->socket()) | 1493 if (connection_->socket()) |
1493 connection_->socket()->Disconnect(); | 1494 connection_->socket()->Disconnect(); |
1494 connection_->Reset(); | 1495 connection_->Reset(); |
1495 delegate_->RemoveRequestFromSpdySessionRequestMapForJob(this); | 1496 delegate_->RemoveRequestFromSpdySessionRequestMapForJob(this); |
1496 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; | 1497 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; |
1497 } else { | 1498 } else { |
1498 // If ReconsiderProxyAfterError() failed synchronously, it means | 1499 // If ReconsiderProxyAfterError() failed synchronously, it means |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 | 1559 |
1559 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1560 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
1560 if (connection_->socket()) { | 1561 if (connection_->socket()) { |
1561 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1562 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
1562 } | 1563 } |
1563 | 1564 |
1564 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1565 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
1565 } | 1566 } |
1566 | 1567 |
1567 } // namespace net | 1568 } // namespace net |
OLD | NEW |