Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 14813024: Introduce RequestWebSocketStream into HttpStreamFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/stl_util.h" 12 #include "base/stl_util.h"
11 #include "base/string_util.h" 13 #include "base/string_util.h"
12 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
13 #include "base/values.h" 15 #include "base/values.h"
14 #include "build/build_config.h" 16 #include "build/build_config.h"
15 #include "net/base/connection_type_histograms.h" 17 #include "net/base/connection_type_histograms.h"
16 #include "net/base/net_log.h" 18 #include "net/base/net_log.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // https (the normal case) or if we're connection to a SPDY proxy, or 276 // https (the normal case) or if we're connection to a SPDY proxy, or
275 // if we're running with force_spdy_always_. crbug.com/133176 277 // if we're running with force_spdy_always_. crbug.com/133176
276 return request_info_.url.SchemeIs("https") || 278 return request_info_.url.SchemeIs("https") ||
277 proxy_info_.proxy_server().is_https() || 279 proxy_info_.proxy_server().is_https() ||
278 force_spdy_always_; 280 force_spdy_always_;
279 } 281 }
280 282
281 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { 283 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() {
282 DCHECK(stream_.get()); 284 DCHECK(stream_.get());
283 DCHECK(!IsPreconnecting()); 285 DCHECK(!IsPreconnecting());
286 DCHECK(!stream_factory_->for_websocket_);
284 if (IsOrphaned()) { 287 if (IsOrphaned()) {
285 stream_factory_->OnOrphanedJobComplete(this); 288 stream_factory_->OnOrphanedJobComplete(this);
286 } else { 289 } else {
287 request_->Complete(was_npn_negotiated(), 290 request_->Complete(was_npn_negotiated(),
288 protocol_negotiated(), 291 protocol_negotiated(),
289 using_spdy(), 292 using_spdy(),
290 net_log_); 293 net_log_);
291 request_->OnStreamReady(this, server_ssl_config_, proxy_info_, 294 request_->OnStreamReady(this, server_ssl_config_, proxy_info_,
292 stream_.release()); 295 stream_.release());
293 } 296 }
294 // |this| may be deleted after this call. 297 // |this| may be deleted after this call.
295 } 298 }
296 299
297 void HttpStreamFactoryImpl::Job::OnSpdySessionReadyCallback() { 300 void HttpStreamFactoryImpl::Job::OnWebSocketStreamReadyCallback() {
301 DCHECK(!IsPreconnecting());
302 DCHECK(stream_factory_->for_websocket_);
303 DCHECK(websocket_stream_);
304 if (IsOrphaned()) {
305 stream_factory_->OnOrphanedJobComplete(this);
306 } else {
307 request_->Complete(was_npn_negotiated(),
308 protocol_negotiated(),
309 using_spdy(),
310 net_log_);
311 request_->OnWebSocketStreamReady(this,
312 server_ssl_config_,
313 proxy_info_,
314 websocket_stream_.release());
315 }
316 // |this| may be deleted after this call.
317 }
318
319 void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() {
298 DCHECK(!stream_.get()); 320 DCHECK(!stream_.get());
299 DCHECK(!IsPreconnecting()); 321 DCHECK(!IsPreconnecting());
300 DCHECK(using_spdy()); 322 DCHECK(using_spdy());
301 DCHECK(new_spdy_session_); 323 DCHECK(new_spdy_session_);
302 scoped_refptr<SpdySession> spdy_session = new_spdy_session_; 324 scoped_refptr<SpdySession> spdy_session = new_spdy_session_;
303 new_spdy_session_ = NULL; 325 new_spdy_session_ = NULL;
304 if (IsOrphaned()) { 326 if (IsOrphaned()) {
305 stream_factory_->OnSpdySessionReady( 327 stream_factory_->OnNewSpdySessionReady(
306 spdy_session, spdy_session_direct_, server_ssl_config_, proxy_info_, 328 spdy_session, spdy_session_direct_, server_ssl_config_, proxy_info_,
307 was_npn_negotiated(), protocol_negotiated(), using_spdy(), net_log_); 329 was_npn_negotiated(), protocol_negotiated(), using_spdy(), net_log_);
308 stream_factory_->OnOrphanedJobComplete(this); 330 stream_factory_->OnOrphanedJobComplete(this);
309 } else { 331 } else {
310 request_->OnSpdySessionReady(this, spdy_session, spdy_session_direct_); 332 request_->OnNewSpdySessionReady(this, spdy_session, spdy_session_direct_);
311 } 333 }
312 // |this| may be deleted after this call. 334 // |this| may be deleted after this call.
313 } 335 }
314 336
315 void HttpStreamFactoryImpl::Job::OnStreamFailedCallback(int result) { 337 void HttpStreamFactoryImpl::Job::OnStreamFailedCallback(int result) {
316 DCHECK(!IsPreconnecting()); 338 DCHECK(!IsPreconnecting());
317 if (IsOrphaned()) 339 if (IsOrphaned())
318 stream_factory_->OnOrphanedJobComplete(this); 340 stream_factory_->OnOrphanedJobComplete(this);
319 else 341 else
320 request_->OnStreamFailed(this, result, server_ssl_config_); 342 request_->OnStreamFailed(this, result, server_ssl_config_);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 stream_factory_->OnOrphanedJobComplete(this); 383 stream_factory_->OnOrphanedJobComplete(this);
362 else 384 else
363 request_->OnHttpsProxyTunnelResponse( 385 request_->OnHttpsProxyTunnelResponse(
364 this, response_info, server_ssl_config_, proxy_info_, stream); 386 this, response_info, server_ssl_config_, proxy_info_, stream);
365 // |this| may be deleted after this call. 387 // |this| may be deleted after this call.
366 } 388 }
367 389
368 void HttpStreamFactoryImpl::Job::OnPreconnectsComplete() { 390 void HttpStreamFactoryImpl::Job::OnPreconnectsComplete() {
369 DCHECK(!request_); 391 DCHECK(!request_);
370 if (new_spdy_session_) { 392 if (new_spdy_session_) {
371 stream_factory_->OnSpdySessionReady( 393 stream_factory_->OnNewSpdySessionReady(
372 new_spdy_session_, spdy_session_direct_, server_ssl_config_, 394 new_spdy_session_, spdy_session_direct_, server_ssl_config_,
373 proxy_info_, was_npn_negotiated(), protocol_negotiated(), using_spdy(), 395 proxy_info_, was_npn_negotiated(), protocol_negotiated(), using_spdy(),
374 net_log_); 396 net_log_);
375 } 397 }
376 stream_factory_->OnPreconnectsComplete(this); 398 stream_factory_->OnPreconnectsComplete(this);
377 // |this| may be deleted after this call. 399 // |this| may be deleted after this call.
378 } 400 }
379 401
380 // static 402 // static
381 int HttpStreamFactoryImpl::Job::OnHostResolution( 403 int HttpStreamFactoryImpl::Job::OnHostResolution(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 459
438 ProxyClientSocket* proxy_socket = 460 ProxyClientSocket* proxy_socket =
439 static_cast<ProxyClientSocket*>(connection_->socket()); 461 static_cast<ProxyClientSocket*>(connection_->socket());
440 const HttpResponseInfo* tunnel_auth_response = 462 const HttpResponseInfo* tunnel_auth_response =
441 proxy_socket->GetConnectResponseInfo(); 463 proxy_socket->GetConnectResponseInfo();
442 464
443 next_state_ = STATE_WAITING_USER_ACTION; 465 next_state_ = STATE_WAITING_USER_ACTION;
444 base::MessageLoop::current()->PostTask( 466 base::MessageLoop::current()->PostTask(
445 FROM_HERE, 467 FROM_HERE,
446 base::Bind( 468 base::Bind(
447 &HttpStreamFactoryImpl::Job::OnNeedsProxyAuthCallback, 469 &Job::OnNeedsProxyAuthCallback,
448 ptr_factory_.GetWeakPtr(), 470 ptr_factory_.GetWeakPtr(),
449 *tunnel_auth_response, 471 *tunnel_auth_response,
450 proxy_socket->GetAuthController())); 472 proxy_socket->GetAuthController()));
451 } 473 }
452 return ERR_IO_PENDING; 474 return ERR_IO_PENDING;
453 475
454 case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: 476 case ERR_SSL_CLIENT_AUTH_CERT_NEEDED:
455 base::MessageLoop::current()->PostTask( 477 base::MessageLoop::current()->PostTask(
456 FROM_HERE, 478 FROM_HERE,
457 base::Bind( 479 base::Bind(
458 &HttpStreamFactoryImpl::Job::OnNeedsClientAuthCallback, 480 &Job::OnNeedsClientAuthCallback,
459 ptr_factory_.GetWeakPtr(), 481 ptr_factory_.GetWeakPtr(),
460 connection_->ssl_error_response_info().cert_request_info)); 482 connection_->ssl_error_response_info().cert_request_info));
461 return ERR_IO_PENDING; 483 return ERR_IO_PENDING;
462 484
463 case ERR_HTTPS_PROXY_TUNNEL_RESPONSE: 485 case ERR_HTTPS_PROXY_TUNNEL_RESPONSE:
464 { 486 {
465 DCHECK(connection_.get()); 487 DCHECK(connection_.get());
466 DCHECK(connection_->socket()); 488 DCHECK(connection_->socket());
467 DCHECK(establishing_tunnel_); 489 DCHECK(establishing_tunnel_);
468 490
469 ProxyClientSocket* proxy_socket = 491 ProxyClientSocket* proxy_socket =
470 static_cast<ProxyClientSocket*>(connection_->socket()); 492 static_cast<ProxyClientSocket*>(connection_->socket());
471 base::MessageLoop::current()->PostTask( 493 base::MessageLoop::current()->PostTask(
472 FROM_HERE, 494 FROM_HERE,
473 base::Bind( 495 base::Bind(
474 &HttpStreamFactoryImpl::Job::OnHttpsProxyTunnelResponseCallback, 496 &Job::OnHttpsProxyTunnelResponseCallback,
475 ptr_factory_.GetWeakPtr(), 497 ptr_factory_.GetWeakPtr(),
476 *proxy_socket->GetConnectResponseInfo(), 498 *proxy_socket->GetConnectResponseInfo(),
477 proxy_socket->CreateConnectResponseStream())); 499 proxy_socket->CreateConnectResponseStream()));
478 return ERR_IO_PENDING; 500 return ERR_IO_PENDING;
479 } 501 }
480 502
481 case OK: 503 case OK:
482 next_state_ = STATE_DONE; 504 next_state_ = STATE_DONE;
483 if (new_spdy_session_) { 505 if (new_spdy_session_) {
484 base::MessageLoop::current()->PostTask( 506 base::MessageLoop::current()->PostTask(
485 FROM_HERE, 507 FROM_HERE,
486 base::Bind( 508 base::Bind(
487 &HttpStreamFactoryImpl::Job::OnSpdySessionReadyCallback, 509 &Job::OnNewSpdySessionReadyCallback,
488 ptr_factory_.GetWeakPtr())); 510 ptr_factory_.GetWeakPtr()));
511 } else if (stream_factory_->for_websocket_) {
512 if (websocket_stream_) {
513 MessageLoop::current()->PostTask(
514 FROM_HERE,
515 base::Bind(
516 &Job::OnWebSocketStreamReadyCallback,
517 ptr_factory_.GetWeakPtr()));
518 } else {
519 base::MessageLoop::current()->PostTask(
520 FROM_HERE,
521 base::Bind(
522 &Job::OnStreamFailedCallback,
523 ptr_factory_.GetWeakPtr(),
524 result));
mmenke 2013/05/24 14:53:22 Calling OnStreamFailedCallback with a result of OK
mmenke 2013/05/24 16:44:43 On second thought, perhaps just a DCHECK instead o
yhirano 2013/05/27 09:21:32 Done.
525 return ERR_IO_PENDING;
526 }
489 } else { 527 } else {
490 base::MessageLoop::current()->PostTask( 528 base::MessageLoop::current()->PostTask(
491 FROM_HERE, 529 FROM_HERE,
492 base::Bind( 530 base::Bind(
493 &HttpStreamFactoryImpl::Job::OnStreamReadyCallback, 531 &Job::OnStreamReadyCallback,
494 ptr_factory_.GetWeakPtr())); 532 ptr_factory_.GetWeakPtr()));
495 } 533 }
496 return ERR_IO_PENDING; 534 return ERR_IO_PENDING;
497 535
498 default: 536 default:
499 base::MessageLoop::current()->PostTask( 537 base::MessageLoop::current()->PostTask(
500 FROM_HERE, 538 FROM_HERE,
501 base::Bind( 539 base::Bind(
502 &HttpStreamFactoryImpl::Job::OnStreamFailedCallback, 540 &Job::OnStreamFailedCallback,
503 ptr_factory_.GetWeakPtr(), 541 ptr_factory_.GetWeakPtr(),
504 result)); 542 result));
505 return ERR_IO_PENDING; 543 return ERR_IO_PENDING;
506 } 544 }
507 return result; 545 return result;
508 } 546 }
509 547
510 int HttpStreamFactoryImpl::Job::DoLoop(int result) { 548 int HttpStreamFactoryImpl::Job::DoLoop(int result) {
511 DCHECK_NE(next_state_, STATE_NONE); 549 DCHECK_NE(next_state_, STATE_NONE);
512 int rv = result; 550 int rv = result;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 request_info_.privacy_mode, 823 request_info_.privacy_mode,
786 net_log_, 824 net_log_,
787 num_streams_); 825 num_streams_);
788 } else { 826 } else {
789 // If we can't use a SPDY session, don't both checking for one after 827 // If we can't use a SPDY session, don't both checking for one after
790 // the hostname is resolved. 828 // the hostname is resolved.
791 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ? 829 OnHostResolutionCallback resolution_callback = CanUseExistingSpdySession() ?
792 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(), 830 base::Bind(&Job::OnHostResolution, session_->spdy_session_pool(),
793 GetSpdySessionKey()) : 831 GetSpdySessionKey()) :
794 OnHostResolutionCallback(); 832 OnHostResolutionCallback();
795 return InitSocketHandleForHttpRequest( 833 return InitSocketHandleForHttpRequest(
mmenke 2013/05/24 14:53:22 This currently always uses the HttpNetworkSession'
yhirano 2013/05/27 09:21:32 Yes, I will do that in another CL.
796 origin_url_, request_info_.extra_headers, request_info_.load_flags, 834 origin_url_, request_info_.extra_headers, request_info_.load_flags,
797 priority_, session_, proxy_info_, ShouldForceSpdySSL(), 835 priority_, session_, proxy_info_, ShouldForceSpdySSL(),
798 want_spdy_over_npn, server_ssl_config_, proxy_ssl_config_, 836 want_spdy_over_npn, server_ssl_config_, proxy_ssl_config_,
799 request_info_.privacy_mode, net_log_, 837 request_info_.privacy_mode, net_log_,
800 connection_.get(), resolution_callback, io_callback_); 838 connection_.get(), resolution_callback, io_callback_);
801 } 839 }
802 } 840 }
803 841
804 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { 842 int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) {
805 if (IsPreconnecting()) { 843 if (IsPreconnecting()) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 if (ssl_socket->WasNpnNegotiated()) { 892 if (ssl_socket->WasNpnNegotiated()) {
855 was_npn_negotiated_ = true; 893 was_npn_negotiated_ = true;
856 std::string proto; 894 std::string proto;
857 std::string server_protos; 895 std::string server_protos;
858 SSLClientSocket::NextProtoStatus status = 896 SSLClientSocket::NextProtoStatus status =
859 ssl_socket->GetNextProto(&proto, &server_protos); 897 ssl_socket->GetNextProto(&proto, &server_protos);
860 NextProto protocol_negotiated = 898 NextProto protocol_negotiated =
861 SSLClientSocket::NextProtoFromString(proto); 899 SSLClientSocket::NextProtoFromString(proto);
862 protocol_negotiated_ = protocol_negotiated; 900 protocol_negotiated_ = protocol_negotiated;
863 net_log_.AddEvent( 901 net_log_.AddEvent(
864 NetLog::TYPE_HTTP_STREAM_REQUEST_PROTO, 902 NetLog::TYPE_HTTP_STREAM_REQUEST_PROTO,
865 base::Bind(&NetLogHttpStreamProtoCallback, 903 base::Bind(&NetLogHttpStreamProtoCallback,
866 status, &proto, &server_protos)); 904 status, &proto, &server_protos));
867 if (ssl_socket->was_spdy_negotiated()) 905 if (ssl_socket->was_spdy_negotiated())
868 SwitchToSpdyMode(); 906 SwitchToSpdyMode();
869 } 907 }
870 if (ShouldForceSpdySSL()) 908 if (ShouldForceSpdySSL())
871 SwitchToSpdyMode(); 909 SwitchToSpdyMode();
872 } else if (proxy_info_.is_https() && connection_->socket() && 910 } else if (proxy_info_.is_https() && connection_->socket() &&
873 result == OK) { 911 result == OK) {
874 ProxyClientSocket* proxy_socket = 912 ProxyClientSocket* proxy_socket =
875 static_cast<ProxyClientSocket*>(connection_->socket()); 913 static_cast<ProxyClientSocket*>(connection_->socket());
876 if (proxy_socket->IsUsingSpdy()) { 914 if (proxy_socket->IsUsingSpdy()) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 if (connection_->socket() && !connection_->is_reused()) 1010 if (connection_->socket() && !connection_->is_reused())
973 SetSocketMotivation(); 1011 SetSocketMotivation();
974 1012
975 if (!using_spdy_) { 1013 if (!using_spdy_) {
976 // We may get ftp scheme when fetching ftp resources through proxy. 1014 // We may get ftp scheme when fetching ftp resources through proxy.
977 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && 1015 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) &&
978 (request_info_.url.SchemeIs("http") || 1016 (request_info_.url.SchemeIs("http") ||
979 request_info_.url.SchemeIs("ftp")); 1017 request_info_.url.SchemeIs("ftp"));
980 if (stream_factory_->http_pipelined_host_pool_. 1018 if (stream_factory_->http_pipelined_host_pool_.
981 IsExistingPipelineAvailableForKey(*http_pipelining_key_.get())) { 1019 IsExistingPipelineAvailableForKey(*http_pipelining_key_.get())) {
1020 DCHECK(!stream_factory_->for_websocket_);
982 stream_.reset(stream_factory_->http_pipelined_host_pool_. 1021 stream_.reset(stream_factory_->http_pipelined_host_pool_.
983 CreateStreamOnExistingPipeline( 1022 CreateStreamOnExistingPipeline(
984 *http_pipelining_key_.get())); 1023 *http_pipelining_key_.get()));
985 CHECK(stream_.get()); 1024 CHECK(stream_.get());
1025 } else if (stream_factory_->for_websocket_) {
1026 DCHECK(request_ && request_->websocket_stream_factory());
1027 websocket_stream_.reset(
1028 request_->websocket_stream_factory()->CreateBasicStream(
1029 connection_.release(), using_proxy));
986 } else if (!using_proxy && IsRequestEligibleForPipelining()) { 1030 } else if (!using_proxy && IsRequestEligibleForPipelining()) {
987 // TODO(simonjam): Support proxies. 1031 // TODO(simonjam): Support proxies.
988 stream_.reset( 1032 stream_.reset(
989 stream_factory_->http_pipelined_host_pool_.CreateStreamOnNewPipeline( 1033 stream_factory_->http_pipelined_host_pool_.CreateStreamOnNewPipeline(
990 *http_pipelining_key_.get(), 1034 *http_pipelining_key_.get(),
991 connection_.release(), 1035 connection_.release(),
992 server_ssl_config_, 1036 server_ssl_config_,
993 proxy_info_, 1037 proxy_info_,
994 net_log_, 1038 net_log_,
995 was_npn_negotiated_, 1039 was_npn_negotiated_,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 } 1088 }
1045 } 1089 }
1046 1090
1047 if (spdy_session->IsClosed()) 1091 if (spdy_session->IsClosed())
1048 return ERR_CONNECTION_CLOSED; 1092 return ERR_CONNECTION_CLOSED;
1049 1093
1050 // TODO(willchan): Delete this code, because eventually, the 1094 // TODO(willchan): Delete this code, because eventually, the
1051 // HttpStreamFactoryImpl will be creating all the SpdyHttpStreams, since it 1095 // HttpStreamFactoryImpl will be creating all the SpdyHttpStreams, since it
1052 // will know when SpdySessions become available. 1096 // will know when SpdySessions become available.
1053 1097
1054 bool use_relative_url = direct || request_info_.url.SchemeIs("https"); 1098 if (stream_factory_->for_websocket_) {
1055 stream_.reset(new SpdyHttpStream(spdy_session, use_relative_url)); 1099 bool use_relative_url = direct || request_info_.url.SchemeIs("wss");
1100 websocket_stream_.reset(
1101 request_->websocket_stream_factory()->CreateSpdyStream(
1102 spdy_session, use_relative_url));
1103 } else {
1104 bool use_relative_url = direct || request_info_.url.SchemeIs("https");
1105 stream_.reset(new SpdyHttpStream(spdy_session, use_relative_url));
1106 }
1056 return OK; 1107 return OK;
1057 } 1108 }
1058 1109
1059 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { 1110 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) {
1060 if (result < 0) 1111 if (result < 0)
1061 return result; 1112 return result;
1062 1113
1063 session_->proxy_service()->ReportSuccess(proxy_info_); 1114 session_->proxy_service()->ReportSuccess(proxy_info_);
1064 next_state_ = STATE_NONE; 1115 next_state_ = STATE_NONE;
1065 return OK; 1116 return OK;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 } 1397 }
1347 1398
1348 bool HttpStreamFactoryImpl::Job::IsOrphaned() const { 1399 bool HttpStreamFactoryImpl::Job::IsOrphaned() const {
1349 return !IsPreconnecting() && !request_; 1400 return !IsPreconnecting() && !request_;
1350 } 1401 }
1351 1402
1352 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() { 1403 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() {
1353 if (IsPreconnecting() || !request_) { 1404 if (IsPreconnecting() || !request_) {
1354 return false; 1405 return false;
1355 } 1406 }
1407 if (stream_factory_->for_websocket_) {
1408 return false;
1409 }
1356 if (session_->force_http_pipelining()) { 1410 if (session_->force_http_pipelining()) {
1357 return true; 1411 return true;
1358 } 1412 }
1359 if (!session_->params().http_pipelining_enabled) { 1413 if (!session_->params().http_pipelining_enabled) {
1360 return false; 1414 return false;
1361 } 1415 }
1362 if (using_ssl_) { 1416 if (using_ssl_) {
1363 return false; 1417 return false;
1364 } 1418 }
1365 if (request_info_.method != "GET" && request_info_.method != "HEAD") { 1419 if (request_info_.method != "GET" && request_info_.method != "HEAD") {
1366 return false; 1420 return false;
1367 } 1421 }
1368 if (request_info_.load_flags & 1422 if (request_info_.load_flags &
1369 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | 1423 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH |
1370 net::LOAD_IS_DOWNLOAD)) { 1424 net::LOAD_IS_DOWNLOAD)) {
1371 // Avoid pipelining resources that may be streamed for a long time. 1425 // Avoid pipelining resources that may be streamed for a long time.
1372 return false; 1426 return false;
1373 } 1427 }
1374 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( 1428 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining(
1375 *http_pipelining_key_.get()); 1429 *http_pipelining_key_.get());
1376 } 1430 }
1377 1431
1378 } // namespace net 1432 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698