| 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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
| 16 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 22 #include "base/thread_task_runner_handle.h" | 22 #include "base/thread_task_runner_handle.h" |
| 23 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "net/base/connection_type_histograms.h" | 25 #include "net/base/connection_type_histograms.h" |
| 26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
| 27 #include "net/base/port_util.h" | 27 #include "net/base/port_util.h" |
| 28 #include "net/cert/cert_verifier.h" | 28 #include "net/cert/cert_verifier.h" |
| 29 #include "net/http/bidirectional_stream_job.h" |
| 29 #include "net/http/http_basic_stream.h" | 30 #include "net/http/http_basic_stream.h" |
| 30 #include "net/http/http_network_session.h" | 31 #include "net/http/http_network_session.h" |
| 31 #include "net/http/http_proxy_client_socket.h" | 32 #include "net/http/http_proxy_client_socket.h" |
| 32 #include "net/http/http_proxy_client_socket_pool.h" | 33 #include "net/http/http_proxy_client_socket_pool.h" |
| 33 #include "net/http/http_request_info.h" | 34 #include "net/http/http_request_info.h" |
| 34 #include "net/http/http_server_properties.h" | 35 #include "net/http/http_server_properties.h" |
| 35 #include "net/http/http_stream_factory.h" | 36 #include "net/http/http_stream_factory.h" |
| 36 #include "net/http/http_stream_factory_impl_request.h" | 37 #include "net/http/http_stream_factory_impl_request.h" |
| 37 #include "net/log/net_log.h" | 38 #include "net/log/net_log.h" |
| 38 #include "net/quic/quic_http_stream.h" | 39 #include "net/quic/quic_http_stream.h" |
| 39 #include "net/socket/client_socket_handle.h" | 40 #include "net/socket/client_socket_handle.h" |
| 40 #include "net/socket/client_socket_pool.h" | 41 #include "net/socket/client_socket_pool.h" |
| 41 #include "net/socket/client_socket_pool_manager.h" | 42 #include "net/socket/client_socket_pool_manager.h" |
| 42 #include "net/socket/socks_client_socket_pool.h" | 43 #include "net/socket/socks_client_socket_pool.h" |
| 43 #include "net/socket/ssl_client_socket.h" | 44 #include "net/socket/ssl_client_socket.h" |
| 44 #include "net/socket/ssl_client_socket_pool.h" | 45 #include "net/socket/ssl_client_socket_pool.h" |
| 45 #include "net/spdy/spdy_http_stream.h" | 46 #include "net/spdy/spdy_http_stream.h" |
| 46 #include "net/spdy/spdy_protocol.h" | 47 #include "net/spdy/spdy_protocol.h" |
| 47 #include "net/spdy/spdy_session.h" | 48 #include "net/spdy/spdy_session.h" |
| 48 #include "net/spdy/spdy_session_pool.h" | 49 #include "net/spdy/spdy_session_pool.h" |
| 49 #include "net/ssl/ssl_cert_request_info.h" | 50 #include "net/ssl/ssl_cert_request_info.h" |
| 50 #include "net/ssl/ssl_connection_status_flags.h" | 51 #include "net/ssl/ssl_connection_status_flags.h" |
| 51 #include "net/ssl/ssl_failure_state.h" | 52 #include "net/ssl/ssl_failure_state.h" |
| 52 | 53 |
| 54 #if defined(ENABLE_BIDIRECTIONAL_STREAM) |
| 55 #include "net/spdy/bidirectional_stream_spdy_job.h" |
| 56 #endif |
| 57 |
| 53 namespace net { | 58 namespace net { |
| 54 | 59 |
| 55 // Returns parameters associated with the start of a HTTP stream job. | 60 // Returns parameters associated with the start of a HTTP stream job. |
| 56 scoped_ptr<base::Value> NetLogHttpStreamJobCallback( | 61 scoped_ptr<base::Value> NetLogHttpStreamJobCallback( |
| 57 const NetLog::Source& source, | 62 const NetLog::Source& source, |
| 58 const GURL* original_url, | 63 const GURL* original_url, |
| 59 const GURL* url, | 64 const GURL* url, |
| 60 const AlternativeService* alternative_service, | 65 const AlternativeService* alternative_service, |
| 61 RequestPriority priority, | 66 RequestPriority priority, |
| 62 NetLogCaptureMode /* capture_mode */) { | 67 NetLogCaptureMode /* capture_mode */) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 quic_request_(session_->quic_stream_factory()), | 135 quic_request_(session_->quic_stream_factory()), |
| 131 using_existing_quic_session_(false), | 136 using_existing_quic_session_(false), |
| 132 spdy_certificate_error_(OK), | 137 spdy_certificate_error_(OK), |
| 133 establishing_tunnel_(false), | 138 establishing_tunnel_(false), |
| 134 was_npn_negotiated_(false), | 139 was_npn_negotiated_(false), |
| 135 protocol_negotiated_(kProtoUnknown), | 140 protocol_negotiated_(kProtoUnknown), |
| 136 num_streams_(0), | 141 num_streams_(0), |
| 137 spdy_session_direct_(false), | 142 spdy_session_direct_(false), |
| 138 job_status_(STATUS_RUNNING), | 143 job_status_(STATUS_RUNNING), |
| 139 other_job_status_(STATUS_RUNNING), | 144 other_job_status_(STATUS_RUNNING), |
| 145 for_bidirectional_(false), |
| 140 ptr_factory_(this) { | 146 ptr_factory_(this) { |
| 141 DCHECK(stream_factory); | 147 DCHECK(stream_factory); |
| 142 DCHECK(session); | 148 DCHECK(session); |
| 143 if (IsQuicAlternative()) { | 149 if (IsQuicAlternative()) { |
| 144 DCHECK(session_->params().enable_quic); | 150 DCHECK(session_->params().enable_quic); |
| 145 using_quic_ = true; | 151 using_quic_ = true; |
| 146 } | 152 } |
| 147 } | 153 } |
| 148 | 154 |
| 149 HttpStreamFactoryImpl::Job::~Job() { | 155 HttpStreamFactoryImpl::Job::~Job() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 161 session_->proxy_service()->CancelPacRequest(pac_request_); | 167 session_->proxy_service()->CancelPacRequest(pac_request_); |
| 162 | 168 |
| 163 // The stream could be in a partial state. It is not reusable. | 169 // The stream could be in a partial state. It is not reusable. |
| 164 if (stream_.get() && next_state_ != STATE_DONE) | 170 if (stream_.get() && next_state_ != STATE_DONE) |
| 165 stream_->Close(true /* not reusable */); | 171 stream_->Close(true /* not reusable */); |
| 166 } | 172 } |
| 167 | 173 |
| 168 void HttpStreamFactoryImpl::Job::Start(Request* request) { | 174 void HttpStreamFactoryImpl::Job::Start(Request* request) { |
| 169 DCHECK(request); | 175 DCHECK(request); |
| 170 request_ = request; | 176 request_ = request; |
| 177 // Saves |for_bidirectional_|, since request is nulled when job is orphaned. |
| 178 for_bidirectional_ = request_->for_bidirectional(); |
| 171 StartInternal(); | 179 StartInternal(); |
| 172 } | 180 } |
| 173 | 181 |
| 174 int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) { | 182 int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) { |
| 175 DCHECK_GT(num_streams, 0); | 183 DCHECK_GT(num_streams, 0); |
| 176 base::WeakPtr<HttpServerProperties> http_server_properties = | 184 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 177 session_->http_server_properties(); | 185 session_->http_server_properties(); |
| 178 if (http_server_properties && | 186 if (http_server_properties && |
| 179 http_server_properties->SupportsRequestPriority( | 187 http_server_properties->SupportsRequestPriority( |
| 180 HostPortPair::FromURL(request_info_.url))) { | 188 HostPortPair::FromURL(request_info_.url))) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 359 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
| 352 | 360 |
| 353 request_->Complete(was_npn_negotiated(), protocol_negotiated(), using_spdy()); | 361 request_->Complete(was_npn_negotiated(), protocol_negotiated(), using_spdy()); |
| 354 request_->OnWebSocketHandshakeStreamReady(this, | 362 request_->OnWebSocketHandshakeStreamReady(this, |
| 355 server_ssl_config_, | 363 server_ssl_config_, |
| 356 proxy_info_, | 364 proxy_info_, |
| 357 websocket_stream_.release()); | 365 websocket_stream_.release()); |
| 358 // |this| may be deleted after this call. | 366 // |this| may be deleted after this call. |
| 359 } | 367 } |
| 360 | 368 |
| 369 void HttpStreamFactoryImpl::Job::OnBidirectionalStreamJobReadyCallback() { |
| 370 DCHECK(bidirectional_stream_job_); |
| 371 |
| 372 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
| 373 |
| 374 if (IsOrphaned()) { |
| 375 stream_factory_->OnOrphanedJobComplete(this); |
| 376 } else { |
| 377 request_->Complete(was_npn_negotiated(), protocol_negotiated(), |
| 378 using_spdy()); |
| 379 request_->OnBidirectionalStreamJobReady( |
| 380 this, server_ssl_config_, proxy_info_, |
| 381 bidirectional_stream_job_.release()); |
| 382 } |
| 383 // |this| may be deleted after this call. |
| 384 } |
| 385 |
| 361 void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() { | 386 void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() { |
| 362 DCHECK(stream_.get()); | 387 DCHECK(stream_.get() || bidirectional_stream_job_.get()); |
| 363 DCHECK(!IsPreconnecting()); | 388 DCHECK(!IsPreconnecting()); |
| 364 DCHECK(using_spdy()); | 389 DCHECK(using_spdy()); |
| 365 // Note: an event loop iteration has passed, so |new_spdy_session_| may be | 390 // Note: an event loop iteration has passed, so |new_spdy_session_| may be |
| 366 // NULL at this point if the SpdySession closed immediately after creation. | 391 // NULL at this point if the SpdySession closed immediately after creation. |
| 367 base::WeakPtr<SpdySession> spdy_session = new_spdy_session_; | 392 base::WeakPtr<SpdySession> spdy_session = new_spdy_session_; |
| 368 new_spdy_session_.reset(); | 393 new_spdy_session_.reset(); |
| 369 | 394 |
| 370 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 395 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
| 371 | 396 |
| 372 // TODO(jgraettinger): Notify the factory, and let that notify |request_|, | 397 // TODO(jgraettinger): Notify the factory, and let that notify |request_|, |
| 373 // rather than notifying |request_| directly. | 398 // rather than notifying |request_| directly. |
| 374 if (IsOrphaned()) { | 399 if (IsOrphaned()) { |
| 375 if (spdy_session) { | 400 if (spdy_session) { |
| 376 stream_factory_->OnNewSpdySessionReady( | 401 stream_factory_->OnNewSpdySessionReady( |
| 377 spdy_session, spdy_session_direct_, server_ssl_config_, proxy_info_, | 402 spdy_session, spdy_session_direct_, server_ssl_config_, proxy_info_, |
| 378 was_npn_negotiated(), protocol_negotiated(), using_spdy(), net_log_); | 403 was_npn_negotiated(), protocol_negotiated(), using_spdy(), net_log_); |
| 379 } | 404 } |
| 380 stream_factory_->OnOrphanedJobComplete(this); | 405 stream_factory_->OnOrphanedJobComplete(this); |
| 381 } else { | 406 } else { |
| 382 request_->OnNewSpdySessionReady( | 407 if (for_bidirectional_) { |
| 383 this, stream_.Pass(), spdy_session, spdy_session_direct_); | 408 DCHECK(bidirectional_stream_job_); |
| 409 request_->OnNewSpdySessionReady(this, /*spdy_http_stream=*/nullptr, |
| 410 bidirectional_stream_job_.Pass(), |
| 411 spdy_session, spdy_session_direct_); |
| 412 |
| 413 } else { |
| 414 DCHECK(stream_); |
| 415 request_->OnNewSpdySessionReady(this, stream_.Pass(), |
| 416 /** bidirectional_stream_job=*/nullptr, |
| 417 spdy_session, spdy_session_direct_); |
| 418 } |
| 384 } | 419 } |
| 385 // |this| may be deleted after this call. | 420 // |this| may be deleted after this call. |
| 386 } | 421 } |
| 387 | 422 |
| 388 void HttpStreamFactoryImpl::Job::OnStreamFailedCallback(int result) { | 423 void HttpStreamFactoryImpl::Job::OnStreamFailedCallback(int result) { |
| 389 DCHECK(!IsPreconnecting()); | 424 DCHECK(!IsPreconnecting()); |
| 390 | 425 |
| 391 MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 426 MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
| 392 | 427 |
| 393 if (IsOrphaned()) { | 428 if (IsOrphaned()) { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 next_state_ = STATE_DONE; | 595 next_state_ = STATE_DONE; |
| 561 if (new_spdy_session_.get()) { | 596 if (new_spdy_session_.get()) { |
| 562 base::ThreadTaskRunnerHandle::Get()->PostTask( | 597 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 563 FROM_HERE, base::Bind(&Job::OnNewSpdySessionReadyCallback, | 598 FROM_HERE, base::Bind(&Job::OnNewSpdySessionReadyCallback, |
| 564 ptr_factory_.GetWeakPtr())); | 599 ptr_factory_.GetWeakPtr())); |
| 565 } else if (stream_factory_->for_websockets_) { | 600 } else if (stream_factory_->for_websockets_) { |
| 566 DCHECK(websocket_stream_); | 601 DCHECK(websocket_stream_); |
| 567 base::ThreadTaskRunnerHandle::Get()->PostTask( | 602 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 568 FROM_HERE, base::Bind(&Job::OnWebSocketHandshakeStreamReadyCallback, | 603 FROM_HERE, base::Bind(&Job::OnWebSocketHandshakeStreamReadyCallback, |
| 569 ptr_factory_.GetWeakPtr())); | 604 ptr_factory_.GetWeakPtr())); |
| 605 } else if (for_bidirectional_) { |
| 606 if (!bidirectional_stream_job_) { |
| 607 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 608 FROM_HERE, base::Bind(&Job::OnStreamFailedCallback, |
| 609 ptr_factory_.GetWeakPtr(), ERR_FAILED)); |
| 610 } else { |
| 611 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 612 FROM_HERE, base::Bind(&Job::OnBidirectionalStreamJobReadyCallback, |
| 613 ptr_factory_.GetWeakPtr())); |
| 614 } |
| 570 } else { | 615 } else { |
| 571 DCHECK(stream_.get()); | 616 DCHECK(stream_.get()); |
| 572 base::ThreadTaskRunnerHandle::Get()->PostTask( | 617 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 573 FROM_HERE, | 618 FROM_HERE, |
| 574 base::Bind(&Job::OnStreamReadyCallback, ptr_factory_.GetWeakPtr())); | 619 base::Bind(&Job::OnStreamReadyCallback, ptr_factory_.GetWeakPtr())); |
| 575 } | 620 } |
| 576 return ERR_IO_PENDING; | 621 return ERR_IO_PENDING; |
| 577 | 622 |
| 578 default: | 623 default: |
| 579 DCHECK(result != ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN || | 624 DCHECK(result != ERR_ALTERNATIVE_CERT_NOT_VALID_FOR_ORIGIN || |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 | 1182 |
| 1138 int HttpStreamFactoryImpl::Job::DoWaitingUserAction(int result) { | 1183 int HttpStreamFactoryImpl::Job::DoWaitingUserAction(int result) { |
| 1139 // This state indicates that the stream request is in a partially | 1184 // This state indicates that the stream request is in a partially |
| 1140 // completed state, and we've called back to the delegate for more | 1185 // completed state, and we've called back to the delegate for more |
| 1141 // information. | 1186 // information. |
| 1142 | 1187 |
| 1143 // We're always waiting here for the delegate to call us back. | 1188 // We're always waiting here for the delegate to call us back. |
| 1144 return ERR_IO_PENDING; | 1189 return ERR_IO_PENDING; |
| 1145 } | 1190 } |
| 1146 | 1191 |
| 1147 int HttpStreamFactoryImpl::Job::SetSpdyHttpStream( | 1192 int HttpStreamFactoryImpl::Job::SetSpdyHttpStreamOrBidirectionalStreamJob( |
| 1148 base::WeakPtr<SpdySession> session, bool direct) { | 1193 base::WeakPtr<SpdySession> session, |
| 1194 bool direct) { |
| 1149 // TODO(ricea): Restore the code for WebSockets over SPDY once it's | 1195 // TODO(ricea): Restore the code for WebSockets over SPDY once it's |
| 1150 // implemented. | 1196 // implemented. |
| 1151 if (stream_factory_->for_websockets_) | 1197 if (stream_factory_->for_websockets_) |
| 1152 return ERR_NOT_IMPLEMENTED; | 1198 return ERR_NOT_IMPLEMENTED; |
| 1199 if (for_bidirectional_) { |
| 1200 #if defined(ENABLE_BIDIRECTIONAL_STREAM) |
| 1201 // TODO(xunjieli): Create QUIC's version of BidirectionalStreamJob. |
| 1202 bidirectional_stream_job_.reset(new BidirectionalStreamSpdyJob(session)); |
| 1203 return OK; |
| 1204 #else |
| 1205 DCHECK(false); |
| 1206 return ERR_FAILED; |
| 1207 #endif |
| 1208 } |
| 1153 | 1209 |
| 1154 // TODO(willchan): Delete this code, because eventually, the | 1210 // TODO(willchan): Delete this code, because eventually, the |
| 1155 // HttpStreamFactoryImpl will be creating all the SpdyHttpStreams, since it | 1211 // HttpStreamFactoryImpl will be creating all the SpdyHttpStreams, since it |
| 1156 // will know when SpdySessions become available. | 1212 // will know when SpdySessions become available. |
| 1157 | 1213 |
| 1158 bool use_relative_url = direct || request_info_.url.SchemeIs("https"); | 1214 bool use_relative_url = direct || request_info_.url.SchemeIs("https"); |
| 1159 stream_.reset(new SpdyHttpStream(session, use_relative_url)); | 1215 stream_.reset(new SpdyHttpStream(session, use_relative_url)); |
| 1160 return OK; | 1216 return OK; |
| 1161 } | 1217 } |
| 1162 | 1218 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 | 1252 |
| 1197 CHECK(!stream_.get()); | 1253 CHECK(!stream_.get()); |
| 1198 | 1254 |
| 1199 bool direct = !IsHttpsProxyAndHttpUrl(); | 1255 bool direct = !IsHttpsProxyAndHttpUrl(); |
| 1200 if (existing_spdy_session_.get()) { | 1256 if (existing_spdy_session_.get()) { |
| 1201 // We picked up an existing session, so we don't need our socket. | 1257 // We picked up an existing session, so we don't need our socket. |
| 1202 if (connection_->socket()) | 1258 if (connection_->socket()) |
| 1203 connection_->socket()->Disconnect(); | 1259 connection_->socket()->Disconnect(); |
| 1204 connection_->Reset(); | 1260 connection_->Reset(); |
| 1205 | 1261 |
| 1206 int set_result = SetSpdyHttpStream(existing_spdy_session_, direct); | 1262 int set_result = SetSpdyHttpStreamOrBidirectionalStreamJob( |
| 1263 existing_spdy_session_, direct); |
| 1207 existing_spdy_session_.reset(); | 1264 existing_spdy_session_.reset(); |
| 1208 return set_result; | 1265 return set_result; |
| 1209 } | 1266 } |
| 1210 | 1267 |
| 1211 SpdySessionKey spdy_session_key = GetSpdySessionKey(); | 1268 SpdySessionKey spdy_session_key = GetSpdySessionKey(); |
| 1212 base::WeakPtr<SpdySession> spdy_session; | 1269 base::WeakPtr<SpdySession> spdy_session; |
| 1213 int result = valid_spdy_session_pool_->FindAvailableSession( | 1270 int result = valid_spdy_session_pool_->FindAvailableSession( |
| 1214 spdy_session_key, net_log_, &spdy_session); | 1271 spdy_session_key, net_log_, &spdy_session); |
| 1215 if (result != OK) { | 1272 if (result != OK) { |
| 1216 return result; | 1273 return result; |
| 1217 } | 1274 } |
| 1218 if (spdy_session) { | 1275 if (spdy_session) { |
| 1219 return SetSpdyHttpStream(spdy_session, direct); | 1276 return SetSpdyHttpStreamOrBidirectionalStreamJob(spdy_session, direct); |
| 1220 } | 1277 } |
| 1221 | 1278 |
| 1222 result = valid_spdy_session_pool_->CreateAvailableSessionFromSocket( | 1279 result = valid_spdy_session_pool_->CreateAvailableSessionFromSocket( |
| 1223 spdy_session_key, connection_.Pass(), net_log_, spdy_certificate_error_, | 1280 spdy_session_key, connection_.Pass(), net_log_, spdy_certificate_error_, |
| 1224 using_ssl_, &spdy_session); | 1281 using_ssl_, &spdy_session); |
| 1225 if (result != OK) { | 1282 if (result != OK) { |
| 1226 return result; | 1283 return result; |
| 1227 } | 1284 } |
| 1228 | 1285 |
| 1229 if (!spdy_session->HasAcceptableTransportSecurity()) { | 1286 if (!spdy_session->HasAcceptableTransportSecurity()) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1244 } | 1301 } |
| 1245 | 1302 |
| 1246 new_spdy_session_ = spdy_session; | 1303 new_spdy_session_ = spdy_session; |
| 1247 spdy_session_direct_ = direct; | 1304 spdy_session_direct_ = direct; |
| 1248 const HostPortPair& host_port_pair = spdy_session_key.host_port_pair(); | 1305 const HostPortPair& host_port_pair = spdy_session_key.host_port_pair(); |
| 1249 base::WeakPtr<HttpServerProperties> http_server_properties = | 1306 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 1250 session_->http_server_properties(); | 1307 session_->http_server_properties(); |
| 1251 if (http_server_properties) | 1308 if (http_server_properties) |
| 1252 http_server_properties->SetSupportsSpdy(host_port_pair, true); | 1309 http_server_properties->SetSupportsSpdy(host_port_pair, true); |
| 1253 | 1310 |
| 1254 // Create a SpdyHttpStream attached to the session; | 1311 // Create a SpdyHttpStream or a BidirectionalStreamJob attached to the |
| 1255 // OnNewSpdySessionReadyCallback is not called until an event loop | 1312 // session; OnNewSpdySessionReadyCallback is not called until an event loop |
| 1256 // iteration later, so if the SpdySession is closed between then, allow | 1313 // iteration later, so if the SpdySession is closed between then, allow |
| 1257 // reuse state from the underlying socket, sampled by SpdyHttpStream, | 1314 // reuse state from the underlying socket, sampled by SpdyHttpStream, |
| 1258 // bubble up to the request. | 1315 // bubble up to the request. |
| 1259 return SetSpdyHttpStream(new_spdy_session_, spdy_session_direct_); | 1316 return SetSpdyHttpStreamOrBidirectionalStreamJob(new_spdy_session_, |
| 1317 spdy_session_direct_); |
| 1260 } | 1318 } |
| 1261 | 1319 |
| 1262 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { | 1320 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { |
| 1263 if (result < 0) | 1321 if (result < 0) |
| 1264 return result; | 1322 return result; |
| 1265 | 1323 |
| 1266 session_->proxy_service()->ReportSuccess(proxy_info_, | 1324 session_->proxy_service()->ReportSuccess(proxy_info_, |
| 1267 session_->network_delegate()); | 1325 session_->network_delegate()); |
| 1268 next_state_ = STATE_NONE; | 1326 next_state_ = STATE_NONE; |
| 1269 return OK; | 1327 return OK; |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 if (connection_->socket()) { | 1673 if (connection_->socket()) { |
| 1616 ConnectionAttempts socket_attempts; | 1674 ConnectionAttempts socket_attempts; |
| 1617 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1675 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1618 request_->AddConnectionAttempts(socket_attempts); | 1676 request_->AddConnectionAttempts(socket_attempts); |
| 1619 } else { | 1677 } else { |
| 1620 request_->AddConnectionAttempts(connection_->connection_attempts()); | 1678 request_->AddConnectionAttempts(connection_->connection_attempts()); |
| 1621 } | 1679 } |
| 1622 } | 1680 } |
| 1623 | 1681 |
| 1624 } // namespace net | 1682 } // namespace net |
| OLD | NEW |