Chromium Code Reviews| 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 "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 bool direct = true; | 740 bool direct = true; |
| 741 SpdySessionPool* spdy_pool = session_->spdy_session_pool(); | 741 SpdySessionPool* spdy_pool = session_->spdy_session_pool(); |
| 742 scoped_refptr<SpdySession> spdy_session; | 742 scoped_refptr<SpdySession> spdy_session; |
| 743 | 743 |
| 744 HostPortProxyPair pair(endpoint_, proxy_server); | 744 HostPortProxyPair pair(endpoint_, proxy_server); |
| 745 if (spdy_pool->HasSession(pair)) { | 745 if (spdy_pool->HasSession(pair)) { |
| 746 // We have a SPDY session to the origin server. This might be a direct | 746 // We have a SPDY session to the origin server. This might be a direct |
| 747 // connection, or it might be a SPDY session through an HTTP or HTTPS proxy. | 747 // connection, or it might be a SPDY session through an HTTP or HTTPS proxy. |
| 748 spdy_session = | 748 spdy_session = |
| 749 spdy_pool->Get(pair, session_->mutable_spdy_settings(), net_log_); | 749 spdy_pool->Get(pair, session_->mutable_spdy_settings(), net_log_); |
| 750 // We don't need our socket. | |
| 751 if (connection_->socket()) | |
| 752 connection_->socket()->Disconnect(); | |
| 753 connection_->Reset(); | |
| 750 } else if (IsHttpsProxyAndHttpUrl()) { | 754 } else if (IsHttpsProxyAndHttpUrl()) { |
| 751 // If we don't have a direct SPDY session, and we're using an HTTPS | 755 // If we don't have a direct SPDY session, and we're using an HTTPS |
| 752 // proxy, then we might have a SPDY session to the proxy | 756 // proxy, then we might have a SPDY session to the proxy |
| 753 pair = HostPortProxyPair(proxy_server.host_port_pair(), | 757 pair = HostPortProxyPair(proxy_server.host_port_pair(), |
| 754 ProxyServer::Direct()); | 758 ProxyServer::Direct()); |
| 755 if (spdy_pool->HasSession(pair)) { | 759 if (spdy_pool->HasSession(pair)) { |
| 756 spdy_session = | 760 spdy_session = |
| 757 spdy_pool->Get(pair, session_->mutable_spdy_settings(), net_log_); | 761 spdy_pool->Get(pair, session_->mutable_spdy_settings(), net_log_); |
| 762 // We don't need our socket. | |
| 763 if (connection_->socket()) | |
| 764 connection_->socket()->Disconnect(); | |
| 765 connection_->Reset(); | |
|
wtc
2010/12/01 02:41:39
You can avoid duplicating this code by moving it t
| |
| 758 } | 766 } |
| 759 direct = false; | 767 direct = false; |
| 760 } | 768 } |
| 761 | 769 |
| 762 if (!spdy_session.get()) { | 770 if (!spdy_session.get()) { |
| 763 // SPDY can be negotiated using the TLS next protocol negotiation (NPN) | 771 // SPDY can be negotiated using the TLS next protocol negotiation (NPN) |
| 764 // extension, or just directly using SSL. Either way, |connection_| must | 772 // extension, or just directly using SSL. Either way, |connection_| must |
| 765 // contain an SSLClientSocket. | 773 // contain an SSLClientSocket. |
| 766 CHECK(connection_->socket()); | 774 CHECK(connection_->socket()); |
| 767 int error = spdy_pool->GetSpdySessionFromSocket( | 775 int error = spdy_pool->GetSpdySessionFromSocket( |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1039 base::TimeDelta::FromMinutes(6), | 1047 base::TimeDelta::FromMinutes(6), |
| 1040 100); | 1048 100); |
| 1041 break; | 1049 break; |
| 1042 default: | 1050 default: |
| 1043 NOTREACHED(); | 1051 NOTREACHED(); |
| 1044 break; | 1052 break; |
| 1045 } | 1053 } |
| 1046 } | 1054 } |
| 1047 | 1055 |
| 1048 } // namespace net | 1056 } // namespace net |
| OLD | NEW |