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

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: Rename delegate functions. 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // https://somehost/ that we don't use that session for http://somehost:443/. 271 // https://somehost/ that we don't use that session for http://somehost:443/.
270 // The only time we can use an existing session is if the request URL is 272 // The only time we can use an existing session is if the request URL is
271 // https (the normal case) or if we're connection to a SPDY proxy, or 273 // https (the normal case) or if we're connection to a SPDY proxy, or
272 // if we're running with force_spdy_always_. crbug.com/133176 274 // if we're running with force_spdy_always_. crbug.com/133176
273 return request_info_.url.SchemeIs("https") || 275 return request_info_.url.SchemeIs("https") ||
274 proxy_info_.proxy_server().is_https() || 276 proxy_info_.proxy_server().is_https() ||
275 force_spdy_always_; 277 force_spdy_always_;
276 } 278 }
277 279
278 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { 280 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() {
281 DCHECK(!request_->for_websocket());
279 DCHECK(stream_.get()); 282 DCHECK(stream_.get());
280 DCHECK(!IsPreconnecting()); 283 DCHECK(!IsPreconnecting());
281 if (IsOrphaned()) { 284 if (IsOrphaned()) {
282 stream_factory_->OnOrphanedJobComplete(this); 285 stream_factory_->OnOrphanedJobComplete(this);
283 } else { 286 } else {
284 request_->Complete(was_npn_negotiated(), 287 request_->Complete(was_npn_negotiated(),
285 protocol_negotiated(), 288 protocol_negotiated(),
286 using_spdy(), 289 using_spdy(),
287 net_log_); 290 net_log_);
288 request_->OnStreamReady(this, server_ssl_config_, proxy_info_, 291 request_->OnStreamReady(this, server_ssl_config_, proxy_info_,
289 stream_.release()); 292 stream_.release());
290 } 293 }
291 // |this| may be deleted after this call. 294 // |this| may be deleted after this call.
292 } 295 }
293 296
294 void HttpStreamFactoryImpl::Job::OnSpdySessionReadyCallback() { 297 void HttpStreamFactoryImpl::Job::OnSocketReadyForWebSocketCallback() {
298 DCHECK(request_->for_websocket());
299 DCHECK(connection_.get() && connection_->is_initialized());
300 DCHECK(!IsPreconnecting());
mmenke 2013/05/23 20:26:20 Looks like when we're preconnected, request_ is NU
yhirano 2013/05/24 14:11:16 Done.
301 if (IsOrphaned()) {
302 stream_factory_->OnOrphanedJobComplete(this);
303 } else {
304 request_->Complete(was_npn_negotiated(),
305 protocol_negotiated(),
306 using_spdy(),
307 net_log_);
308 request_->OnSocketReadyForWebSocket(this, server_ssl_config_, proxy_info_,
309 connection_.release());
310 }
311 // |this| may be deleted after this call.
312 }
313
314 void HttpStreamFactoryImpl::Job::OnSpdySessionReadyForWebSocketCallback() {
315 DCHECK(request_->for_websocket());
316 DCHECK(spdy_session_to_pass_);
317 DCHECK(!IsPreconnecting());
318 scoped_refptr<SpdySession> session = spdy_session_to_pass_;
319 spdy_session_to_pass_ = NULL;
320 if (IsOrphaned()) {
321 stream_factory_->OnOrphanedJobComplete(this);
mmenke 2013/05/23 20:26:20 This is what was confusing me before - we don't ca
yhirano 2013/05/24 14:11:16 In PS 13 (or newer), OnNewSpdySessionReady is call
322 } else {
323 request_->Complete(was_npn_negotiated(),
324 protocol_negotiated(),
325 using_spdy(),
326 net_log_);
327 request_->OnSpdySessionReadyForWebSocket(this,
328 server_ssl_config_,
329 proxy_info_,
330 session);
331 }
332 // |this| may be deleted after this call.
333 }
334
335 void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() {
295 DCHECK(!stream_.get()); 336 DCHECK(!stream_.get());
296 DCHECK(!IsPreconnecting()); 337 DCHECK(!IsPreconnecting());
338 DCHECK(!request_->for_websocket());
297 DCHECK(using_spdy()); 339 DCHECK(using_spdy());
298 DCHECK(new_spdy_session_); 340 DCHECK(new_spdy_session_);
299 scoped_refptr<SpdySession> spdy_session = new_spdy_session_; 341 scoped_refptr<SpdySession> spdy_session = new_spdy_session_;
300 new_spdy_session_ = NULL; 342 new_spdy_session_ = NULL;
301 if (IsOrphaned()) { 343 if (IsOrphaned()) {
302 stream_factory_->OnSpdySessionReady( 344 stream_factory_->OnNewSpdySessionReady(
303 spdy_session, spdy_session_direct_, server_ssl_config_, proxy_info_, 345 spdy_session, spdy_session_direct_, server_ssl_config_, proxy_info_,
304 was_npn_negotiated(), protocol_negotiated(), using_spdy(), net_log_); 346 was_npn_negotiated(), protocol_negotiated(), using_spdy(), net_log_);
305 stream_factory_->OnOrphanedJobComplete(this); 347 stream_factory_->OnOrphanedJobComplete(this);
306 } else { 348 } else {
307 request_->OnSpdySessionReady(this, spdy_session, spdy_session_direct_); 349 request_->OnNewSpdySessionReady(this, spdy_session, spdy_session_direct_);
308 } 350 }
309 // |this| may be deleted after this call. 351 // |this| may be deleted after this call.
310 } 352 }
311 353
312 void HttpStreamFactoryImpl::Job::OnStreamFailedCallback(int result) { 354 void HttpStreamFactoryImpl::Job::OnStreamFailedCallback(int result) {
313 DCHECK(!IsPreconnecting()); 355 DCHECK(!IsPreconnecting());
314 if (IsOrphaned()) 356 if (IsOrphaned())
315 stream_factory_->OnOrphanedJobComplete(this); 357 stream_factory_->OnOrphanedJobComplete(this);
316 else 358 else
317 request_->OnStreamFailed(this, result, server_ssl_config_); 359 request_->OnStreamFailed(this, result, server_ssl_config_);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 stream_factory_->OnOrphanedJobComplete(this); 400 stream_factory_->OnOrphanedJobComplete(this);
359 else 401 else
360 request_->OnHttpsProxyTunnelResponse( 402 request_->OnHttpsProxyTunnelResponse(
361 this, response_info, server_ssl_config_, proxy_info_, stream); 403 this, response_info, server_ssl_config_, proxy_info_, stream);
362 // |this| may be deleted after this call. 404 // |this| may be deleted after this call.
363 } 405 }
364 406
365 void HttpStreamFactoryImpl::Job::OnPreconnectsComplete() { 407 void HttpStreamFactoryImpl::Job::OnPreconnectsComplete() {
366 DCHECK(!request_); 408 DCHECK(!request_);
367 if (new_spdy_session_) { 409 if (new_spdy_session_) {
368 stream_factory_->OnSpdySessionReady( 410 stream_factory_->OnNewSpdySessionReady(
369 new_spdy_session_, spdy_session_direct_, server_ssl_config_, 411 new_spdy_session_, spdy_session_direct_, server_ssl_config_,
370 proxy_info_, was_npn_negotiated(), protocol_negotiated(), using_spdy(), 412 proxy_info_, was_npn_negotiated(), protocol_negotiated(), using_spdy(),
371 net_log_); 413 net_log_);
372 } 414 }
373 stream_factory_->OnPreconnectsComplete(this); 415 stream_factory_->OnPreconnectsComplete(this);
374 // |this| may be deleted after this call. 416 // |this| may be deleted after this call.
375 } 417 }
376 418
377 // static 419 // static
378 int HttpStreamFactoryImpl::Job::OnHostResolution( 420 int HttpStreamFactoryImpl::Job::OnHostResolution(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 476
435 ProxyClientSocket* proxy_socket = 477 ProxyClientSocket* proxy_socket =
436 static_cast<ProxyClientSocket*>(connection_->socket()); 478 static_cast<ProxyClientSocket*>(connection_->socket());
437 const HttpResponseInfo* tunnel_auth_response = 479 const HttpResponseInfo* tunnel_auth_response =
438 proxy_socket->GetConnectResponseInfo(); 480 proxy_socket->GetConnectResponseInfo();
439 481
440 next_state_ = STATE_WAITING_USER_ACTION; 482 next_state_ = STATE_WAITING_USER_ACTION;
441 MessageLoop::current()->PostTask( 483 MessageLoop::current()->PostTask(
442 FROM_HERE, 484 FROM_HERE,
443 base::Bind( 485 base::Bind(
444 &HttpStreamFactoryImpl::Job::OnNeedsProxyAuthCallback, 486 &Job::OnNeedsProxyAuthCallback,
445 ptr_factory_.GetWeakPtr(), 487 ptr_factory_.GetWeakPtr(),
446 *tunnel_auth_response, 488 *tunnel_auth_response,
447 proxy_socket->GetAuthController())); 489 proxy_socket->GetAuthController()));
448 } 490 }
449 return ERR_IO_PENDING; 491 return ERR_IO_PENDING;
450 492
451 case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: 493 case ERR_SSL_CLIENT_AUTH_CERT_NEEDED:
452 MessageLoop::current()->PostTask( 494 MessageLoop::current()->PostTask(
453 FROM_HERE, 495 FROM_HERE,
454 base::Bind( 496 base::Bind(
455 &HttpStreamFactoryImpl::Job::OnNeedsClientAuthCallback, 497 &Job::OnNeedsClientAuthCallback,
456 ptr_factory_.GetWeakPtr(), 498 ptr_factory_.GetWeakPtr(),
457 connection_->ssl_error_response_info().cert_request_info)); 499 connection_->ssl_error_response_info().cert_request_info));
458 return ERR_IO_PENDING; 500 return ERR_IO_PENDING;
459 501
460 case ERR_HTTPS_PROXY_TUNNEL_RESPONSE: 502 case ERR_HTTPS_PROXY_TUNNEL_RESPONSE:
461 { 503 {
462 DCHECK(connection_.get()); 504 DCHECK(connection_.get());
463 DCHECK(connection_->socket()); 505 DCHECK(connection_->socket());
464 DCHECK(establishing_tunnel_); 506 DCHECK(establishing_tunnel_);
465 507
466 ProxyClientSocket* proxy_socket = 508 ProxyClientSocket* proxy_socket =
467 static_cast<ProxyClientSocket*>(connection_->socket()); 509 static_cast<ProxyClientSocket*>(connection_->socket());
468 MessageLoop::current()->PostTask( 510 MessageLoop::current()->PostTask(
469 FROM_HERE, 511 FROM_HERE,
470 base::Bind( 512 base::Bind(
471 &HttpStreamFactoryImpl::Job::OnHttpsProxyTunnelResponseCallback, 513 &Job::OnHttpsProxyTunnelResponseCallback,
472 ptr_factory_.GetWeakPtr(), 514 ptr_factory_.GetWeakPtr(),
473 *proxy_socket->GetConnectResponseInfo(), 515 *proxy_socket->GetConnectResponseInfo(),
474 proxy_socket->CreateConnectResponseStream())); 516 proxy_socket->CreateConnectResponseStream()));
475 return ERR_IO_PENDING; 517 return ERR_IO_PENDING;
476 } 518 }
477 519
478 case OK: 520 case OK:
479 next_state_ = STATE_DONE; 521 next_state_ = STATE_DONE;
480 if (new_spdy_session_) { 522 if (request_->for_websocket()) {
523 if (spdy_session_to_pass_) {
524 MessageLoop::current()->PostTask(
525 FROM_HERE,
526 base::Bind(
527 &Job::OnSpdySessionReadyForWebSocketCallback,
528 ptr_factory_.GetWeakPtr()));
529 } else if (connection_ && connection_->is_initialized()) {
530 MessageLoop::current()->PostTask(
531 FROM_HERE,
532 base::Bind(
533 &Job::OnSocketReadyForWebSocketCallback,
534 ptr_factory_.GetWeakPtr()));
535 } else {
536 return ERR_FAILED;
mmenke 2013/05/23 20:26:20 We should fail asynchronously in this case, just l
yhirano 2013/05/24 14:11:16 Done.
537 }
538 } else if (new_spdy_session_) {
481 MessageLoop::current()->PostTask( 539 MessageLoop::current()->PostTask(
482 FROM_HERE, 540 FROM_HERE,
483 base::Bind( 541 base::Bind(
484 &HttpStreamFactoryImpl::Job::OnSpdySessionReadyCallback, 542 &Job::OnNewSpdySessionReadyCallback,
485 ptr_factory_.GetWeakPtr())); 543 ptr_factory_.GetWeakPtr()));
486 } else { 544 } else {
487 MessageLoop::current()->PostTask( 545 MessageLoop::current()->PostTask(
488 FROM_HERE, 546 FROM_HERE,
489 base::Bind( 547 base::Bind(
490 &HttpStreamFactoryImpl::Job::OnStreamReadyCallback, 548 &Job::OnStreamReadyCallback,
491 ptr_factory_.GetWeakPtr())); 549 ptr_factory_.GetWeakPtr()));
492 } 550 }
493 return ERR_IO_PENDING; 551 return ERR_IO_PENDING;
494 552
495 default: 553 default:
496 MessageLoop::current()->PostTask( 554 MessageLoop::current()->PostTask(
497 FROM_HERE, 555 FROM_HERE,
498 base::Bind( 556 base::Bind(
499 &HttpStreamFactoryImpl::Job::OnStreamFailedCallback, 557 &Job::OnStreamFailedCallback,
500 ptr_factory_.GetWeakPtr(), 558 ptr_factory_.GetWeakPtr(),
501 result)); 559 result));
502 return ERR_IO_PENDING; 560 return ERR_IO_PENDING;
503 } 561 }
504 return result; 562 return result;
505 } 563 }
506 564
507 int HttpStreamFactoryImpl::Job::DoLoop(int result) { 565 int HttpStreamFactoryImpl::Job::DoLoop(int result) {
508 DCHECK_NE(next_state_, STATE_NONE); 566 DCHECK_NE(next_state_, STATE_NONE);
509 int rv = result; 567 int rv = result;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 if (ssl_socket->WasNpnNegotiated()) { 905 if (ssl_socket->WasNpnNegotiated()) {
848 was_npn_negotiated_ = true; 906 was_npn_negotiated_ = true;
849 std::string proto; 907 std::string proto;
850 std::string server_protos; 908 std::string server_protos;
851 SSLClientSocket::NextProtoStatus status = 909 SSLClientSocket::NextProtoStatus status =
852 ssl_socket->GetNextProto(&proto, &server_protos); 910 ssl_socket->GetNextProto(&proto, &server_protos);
853 NextProto protocol_negotiated = 911 NextProto protocol_negotiated =
854 SSLClientSocket::NextProtoFromString(proto); 912 SSLClientSocket::NextProtoFromString(proto);
855 protocol_negotiated_ = protocol_negotiated; 913 protocol_negotiated_ = protocol_negotiated;
856 net_log_.AddEvent( 914 net_log_.AddEvent(
857 NetLog::TYPE_HTTP_STREAM_REQUEST_PROTO, 915 NetLog::TYPE_HTTP_STREAM_REQUEST_PROTO,
858 base::Bind(&NetLogHttpStreamProtoCallback, 916 base::Bind(&NetLogHttpStreamProtoCallback,
859 status, &proto, &server_protos)); 917 status, &proto, &server_protos));
860 if (ssl_socket->was_spdy_negotiated()) 918 if (ssl_socket->was_spdy_negotiated())
861 SwitchToSpdyMode(); 919 SwitchToSpdyMode();
862 } 920 }
863 if (ShouldForceSpdySSL()) 921 if (ShouldForceSpdySSL())
864 SwitchToSpdyMode(); 922 SwitchToSpdyMode();
865 } else if (proxy_info_.is_https() && connection_->socket() && 923 } else if (proxy_info_.is_https() && connection_->socket() &&
866 result == OK) { 924 result == OK) {
867 ProxyClientSocket* proxy_socket = 925 ProxyClientSocket* proxy_socket =
868 static_cast<ProxyClientSocket*>(connection_->socket()); 926 static_cast<ProxyClientSocket*>(connection_->socket());
869 if (proxy_socket->IsUsingSpdy()) { 927 if (proxy_socket->IsUsingSpdy()) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 if (connection_->socket() && !connection_->is_reused()) 1021 if (connection_->socket() && !connection_->is_reused())
964 SetSocketMotivation(); 1022 SetSocketMotivation();
965 1023
966 if (!using_spdy_) { 1024 if (!using_spdy_) {
967 // We may get ftp scheme when fetching ftp resources through proxy. 1025 // We may get ftp scheme when fetching ftp resources through proxy.
968 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && 1026 bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) &&
969 (request_info_.url.SchemeIs("http") || 1027 (request_info_.url.SchemeIs("http") ||
970 request_info_.url.SchemeIs("ftp")); 1028 request_info_.url.SchemeIs("ftp"));
971 if (stream_factory_->http_pipelined_host_pool_. 1029 if (stream_factory_->http_pipelined_host_pool_.
972 IsExistingPipelineAvailableForKey(*http_pipelining_key_.get())) { 1030 IsExistingPipelineAvailableForKey(*http_pipelining_key_.get())) {
1031 DCHECK(!request_->for_websocket());
973 stream_.reset(stream_factory_->http_pipelined_host_pool_. 1032 stream_.reset(stream_factory_->http_pipelined_host_pool_.
974 CreateStreamOnExistingPipeline( 1033 CreateStreamOnExistingPipeline(
975 *http_pipelining_key_.get())); 1034 *http_pipelining_key_.get()));
976 CHECK(stream_.get()); 1035 CHECK(stream_.get());
1036 } else if (request_->for_websocket()) {
1037 // Do nothing.
1038 // connection_ will be passed to the delegate.
mmenke 2013/05/23 20:26:20 Not creating a stream in DoCreateStream in this ca
yhirano 2013/05/24 14:11:16 Done.
977 } else if (!using_proxy && IsRequestEligibleForPipelining()) { 1039 } else if (!using_proxy && IsRequestEligibleForPipelining()) {
978 // TODO(simonjam): Support proxies. 1040 // TODO(simonjam): Support proxies.
979 stream_.reset( 1041 stream_.reset(
980 stream_factory_->http_pipelined_host_pool_.CreateStreamOnNewPipeline( 1042 stream_factory_->http_pipelined_host_pool_.CreateStreamOnNewPipeline(
981 *http_pipelining_key_.get(), 1043 *http_pipelining_key_.get(),
982 connection_.release(), 1044 connection_.release(),
983 server_ssl_config_, 1045 server_ssl_config_,
984 proxy_info_, 1046 proxy_info_,
985 net_log_, 1047 net_log_,
986 was_npn_negotiated_, 1048 was_npn_negotiated_,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 pair, connection_.release(), net_log_, spdy_certificate_error_, 1083 pair, connection_.release(), net_log_, spdy_certificate_error_,
1022 &new_spdy_session_, using_ssl_); 1084 &new_spdy_session_, using_ssl_);
1023 if (error != OK) 1085 if (error != OK)
1024 return error; 1086 return error;
1025 const HostPortPair& host_port_pair = pair.first; 1087 const HostPortPair& host_port_pair = pair.first;
1026 HttpServerProperties* http_server_properties = 1088 HttpServerProperties* http_server_properties =
1027 session_->http_server_properties(); 1089 session_->http_server_properties();
1028 if (http_server_properties) 1090 if (http_server_properties)
1029 http_server_properties->SetSupportsSpdy(host_port_pair, true); 1091 http_server_properties->SetSupportsSpdy(host_port_pair, true);
1030 spdy_session_direct_ = direct; 1092 spdy_session_direct_ = direct;
1093 if (request_->for_websocket()) {
1094 DCHECK(!spdy_session_to_pass_);
1095 spdy_session_to_pass_.swap(new_spdy_session_);
1096 }
1031 return OK; 1097 return OK;
1032 } 1098 }
1033 } 1099 }
1034 1100
1035 if (spdy_session->IsClosed()) 1101 if (spdy_session->IsClosed())
1036 return ERR_CONNECTION_CLOSED; 1102 return ERR_CONNECTION_CLOSED;
1037 1103
1104 if (request_->for_websocket()) {
1105 DCHECK(!spdy_session_to_pass_);
1106 spdy_session_to_pass_.swap(spdy_session);
1107 return OK;
1108 }
1109
1038 // TODO(willchan): Delete this code, because eventually, the 1110 // TODO(willchan): Delete this code, because eventually, the
1039 // HttpStreamFactoryImpl will be creating all the SpdyHttpStreams, since it 1111 // HttpStreamFactoryImpl will be creating all the SpdyHttpStreams, since it
1040 // will know when SpdySessions become available. 1112 // will know when SpdySessions become available.
1041 1113
1042 bool use_relative_url = direct || request_info_.url.SchemeIs("https"); 1114 bool use_relative_url = direct || request_info_.url.SchemeIs("https");
1043 stream_.reset(new SpdyHttpStream(spdy_session, use_relative_url)); 1115 stream_.reset(new SpdyHttpStream(spdy_session, use_relative_url));
1044 return OK; 1116 return OK;
1045 } 1117 }
1046 1118
1047 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { 1119 int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 } 1402 }
1331 1403
1332 bool HttpStreamFactoryImpl::Job::IsOrphaned() const { 1404 bool HttpStreamFactoryImpl::Job::IsOrphaned() const {
1333 return !IsPreconnecting() && !request_; 1405 return !IsPreconnecting() && !request_;
1334 } 1406 }
1335 1407
1336 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() { 1408 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() {
1337 if (IsPreconnecting() || !request_) { 1409 if (IsPreconnecting() || !request_) {
1338 return false; 1410 return false;
1339 } 1411 }
1412 if (request_->for_websocket()) {
1413 return false;
1414 }
1340 if (session_->force_http_pipelining()) { 1415 if (session_->force_http_pipelining()) {
1341 return true; 1416 return true;
1342 } 1417 }
1343 if (!session_->params().http_pipelining_enabled) { 1418 if (!session_->params().http_pipelining_enabled) {
1344 return false; 1419 return false;
1345 } 1420 }
1346 if (using_ssl_) { 1421 if (using_ssl_) {
1347 return false; 1422 return false;
1348 } 1423 }
1349 if (request_info_.method != "GET" && request_info_.method != "HEAD") { 1424 if (request_info_.method != "GET" && request_info_.method != "HEAD") {
1350 return false; 1425 return false;
1351 } 1426 }
1352 if (request_info_.load_flags & 1427 if (request_info_.load_flags &
1353 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | 1428 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH |
1354 net::LOAD_IS_DOWNLOAD)) { 1429 net::LOAD_IS_DOWNLOAD)) {
1355 // Avoid pipelining resources that may be streamed for a long time. 1430 // Avoid pipelining resources that may be streamed for a long time.
1356 return false; 1431 return false;
1357 } 1432 }
1358 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( 1433 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining(
1359 *http_pipelining_key_.get()); 1434 *http_pipelining_key_.get());
1360 } 1435 }
1361 1436
1362 } // namespace net 1437 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698