OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_request.h" | 5 #include "net/http/http_stream_request.h" |
6 | 6 |
7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/connection_type_histograms.h" | 10 #include "net/base/connection_type_histograms.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 bool want_spdy_over_npn = | 416 bool want_spdy_over_npn = |
417 alternate_protocol_mode_ == kUsingAlternateProtocol && | 417 alternate_protocol_mode_ == kUsingAlternateProtocol && |
418 alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_2; | 418 alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_2; |
419 using_ssl_ = request_info().url.SchemeIs("https") || | 419 using_ssl_ = request_info().url.SchemeIs("https") || |
420 (force_spdy_always_ && force_spdy_over_ssl_) || | 420 (force_spdy_always_ && force_spdy_over_ssl_) || |
421 want_spdy_over_npn; | 421 want_spdy_over_npn; |
422 using_spdy_ = false; | 422 using_spdy_ = false; |
423 | 423 |
424 // Check first if we have a spdy session for this group. If so, then go | 424 // Check first if we have a spdy session for this group. If so, then go |
425 // straight to using that. | 425 // straight to using that. |
426 HostPortProxyPair pair(endpoint_, proxy_info()->proxy_server().ToPacString()); | 426 HostPortProxyPair pair(endpoint_, proxy_info()->proxy_server()); |
427 if (session_->spdy_session_pool()->HasSession(pair)) { | 427 if (session_->spdy_session_pool()->HasSession(pair)) { |
428 using_spdy_ = true; | 428 using_spdy_ = true; |
429 next_state_ = STATE_INIT_STREAM; | 429 next_state_ = STATE_INIT_STREAM; |
430 return OK; | 430 return OK; |
431 } | 431 } |
432 | 432 |
433 // Build the string used to uniquely identify connections of this type. | 433 // Build the string used to uniquely identify connections of this type. |
434 // Determine the host and port to connect to. | 434 // Determine the host and port to connect to. |
435 std::string connection_group = endpoint_.ToString(); | 435 std::string connection_group = endpoint_.ToString(); |
436 DCHECK(!connection_group.empty()); | 436 DCHECK(!connection_group.empty()); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 stream_.reset(new HttpStreamHandle(connection_.release(), stream)); | 677 stream_.reset(new HttpStreamHandle(connection_.release(), stream)); |
678 return stream_->InitializeStream(&request_info(), net_log_, &io_callback_); | 678 return stream_->InitializeStream(&request_info(), net_log_, &io_callback_); |
679 } | 679 } |
680 | 680 |
681 CHECK(!stream_.get()); | 681 CHECK(!stream_.get()); |
682 | 682 |
683 const scoped_refptr<SpdySessionPool> spdy_pool = | 683 const scoped_refptr<SpdySessionPool> spdy_pool = |
684 session_->spdy_session_pool(); | 684 session_->spdy_session_pool(); |
685 scoped_refptr<SpdySession> spdy_session; | 685 scoped_refptr<SpdySession> spdy_session; |
686 | 686 |
687 HostPortProxyPair pair(endpoint_, | 687 HostPortProxyPair pair(endpoint_, proxy_info()->proxy_server()); |
688 proxy_info()->proxy_server().ToPacString()); | |
689 if (session_->spdy_session_pool()->HasSession(pair)) { | 688 if (session_->spdy_session_pool()->HasSession(pair)) { |
690 spdy_session = | 689 spdy_session = |
691 session_->spdy_session_pool()->Get(pair, session_, net_log_); | 690 session_->spdy_session_pool()->Get(pair, session_, net_log_); |
692 } else { | 691 } else { |
693 // SPDY can be negotiated using the TLS next protocol negotiation (NPN) | 692 // SPDY can be negotiated using the TLS next protocol negotiation (NPN) |
694 // extension, or just directly using SSL. Either way, |connection_| must | 693 // extension, or just directly using SSL. Either way, |connection_| must |
695 // contain an SSLClientSocket. | 694 // contain an SSLClientSocket. |
696 CHECK(connection_->socket()); | 695 CHECK(connection_->socket()); |
697 int error = spdy_pool->GetSpdySessionFromSocket( | 696 int error = spdy_pool->GetSpdySessionFromSocket( |
698 pair, session_, connection_.release(), net_log_, | 697 pair, session_, connection_.release(), net_log_, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 100); | 909 100); |
911 break; | 910 break; |
912 default: | 911 default: |
913 NOTREACHED(); | 912 NOTREACHED(); |
914 break; | 913 break; |
915 } | 914 } |
916 } | 915 } |
917 | 916 |
918 } // namespace net | 917 } // namespace net |
919 | 918 |
OLD | NEW |