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

Side by Side Diff: net/spdy/spdy_session.cc

Issue 9958028: Add a new GetNegotiatedProtocol method to StreamSocket and implement in all subclasses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.cc ('k') | remoting/jingle_glue/ssl_socket_adapter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 431
432 state_ = CONNECTED; 432 state_ = CONNECTED;
433 connection_.reset(connection); 433 connection_.reset(connection);
434 connection_->AddLayeredPool(this); 434 connection_->AddLayeredPool(this);
435 is_secure_ = is_secure; 435 is_secure_ = is_secure;
436 certificate_error_code_ = certificate_error_code; 436 certificate_error_code_ = certificate_error_code;
437 437
438 NextProto protocol = g_default_protocol; 438 NextProto protocol = g_default_protocol;
439 if (is_secure_) { 439 if (is_secure_) {
440 SSLClientSocket* ssl_socket = GetSSLClientSocket(); 440 SSLClientSocket* ssl_socket = GetSSLClientSocket();
441 NextProto protocol_negotiated = ssl_socket->protocol_negotiated(); 441 NextProto protocol_negotiated = ssl_socket->GetNegotiatedProtocol();
442 if (protocol_negotiated != kProtoUnknown) { 442 if (protocol_negotiated != kProtoUnknown) {
443 protocol = protocol_negotiated; 443 protocol = protocol_negotiated;
444 } 444 }
445 445
446 if (ssl_socket->WasDomainBoundCertSent()) { 446 if (ssl_socket->WasDomainBoundCertSent()) {
447 // According to the SPDY spec, the credential associated with the TLS 447 // According to the SPDY spec, the credential associated with the TLS
448 // connection is stored in slot[1]. 448 // connection is stored in slot[1].
449 credential_state_.SetHasCredential(GURL("https://" + 449 credential_state_.SetHasCredential(GURL("https://" +
450 host_port_pair().ToString())); 450 host_port_pair().ToString()));
451 } 451 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 DCHECK(priority >= net::HIGHEST && priority < net::NUM_PRIORITIES); 626 DCHECK(priority >= net::HIGHEST && priority < net::NUM_PRIORITIES);
627 627
628 DCHECK_EQ(active_streams_[stream_id].get(), stream.get()); 628 DCHECK_EQ(active_streams_[stream_id].get(), stream.get());
629 return OK; 629 return OK;
630 } 630 }
631 631
632 bool SpdySession::NeedsCredentials() const { 632 bool SpdySession::NeedsCredentials() const {
633 if (!is_secure_) 633 if (!is_secure_)
634 return false; 634 return false;
635 SSLClientSocket* ssl_socket = GetSSLClientSocket(); 635 SSLClientSocket* ssl_socket = GetSSLClientSocket();
636 if (ssl_socket->protocol_negotiated() < kProtoSPDY3) 636 if (ssl_socket->GetNegotiatedProtocol() < kProtoSPDY3)
637 return false; 637 return false;
638 return ssl_socket->WasDomainBoundCertSent(); 638 return ssl_socket->WasDomainBoundCertSent();
639 } 639 }
640 640
641 void SpdySession::AddPooledAlias(const HostPortProxyPair& alias) { 641 void SpdySession::AddPooledAlias(const HostPortProxyPair& alias) {
642 pooled_aliases_.insert(alias); 642 pooled_aliases_.insert(alias);
643 } 643 }
644 644
645 int SpdySession::GetProtocolVersion() const { 645 int SpdySession::GetProtocolVersion() const {
646 DCHECK(buffered_spdy_framer_.get()); 646 DCHECK(buffered_spdy_framer_.get());
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 1180
1181 dict->SetInteger("active_streams", active_streams_.size()); 1181 dict->SetInteger("active_streams", active_streams_.size());
1182 1182
1183 dict->SetInteger("unclaimed_pushed_streams", 1183 dict->SetInteger("unclaimed_pushed_streams",
1184 unclaimed_pushed_streams_.size()); 1184 unclaimed_pushed_streams_.size());
1185 1185
1186 dict->SetBoolean("is_secure", is_secure_); 1186 dict->SetBoolean("is_secure", is_secure_);
1187 1187
1188 NextProto proto = kProtoUnknown; 1188 NextProto proto = kProtoUnknown;
1189 if (is_secure_) { 1189 if (is_secure_) {
1190 proto = GetSSLClientSocket()->protocol_negotiated(); 1190 proto = GetSSLClientSocket()->GetNegotiatedProtocol();
1191 } 1191 }
1192 dict->SetString("protocol_negotiated", 1192 dict->SetString("protocol_negotiated",
1193 SSLClientSocket::NextProtoToString(proto)); 1193 SSLClientSocket::NextProtoToString(proto));
1194 1194
1195 dict->SetInteger("error", error_); 1195 dict->SetInteger("error", error_);
1196 dict->SetInteger("max_concurrent_streams", max_concurrent_streams_); 1196 dict->SetInteger("max_concurrent_streams", max_concurrent_streams_);
1197 1197
1198 dict->SetInteger("streams_initiated_count", streams_initiated_count_); 1198 dict->SetInteger("streams_initiated_count", streams_initiated_count_);
1199 dict->SetInteger("streams_pushed_count", streams_pushed_count_); 1199 dict->SetInteger("streams_pushed_count", streams_pushed_count_);
1200 dict->SetInteger("streams_pushed_and_claimed_count", 1200 dict->SetInteger("streams_pushed_and_claimed_count",
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, 1300 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info,
1301 bool* was_npn_negotiated, 1301 bool* was_npn_negotiated,
1302 NextProto* protocol_negotiated) { 1302 NextProto* protocol_negotiated) {
1303 if (!is_secure_) { 1303 if (!is_secure_) {
1304 *protocol_negotiated = kProtoUnknown; 1304 *protocol_negotiated = kProtoUnknown;
1305 return false; 1305 return false;
1306 } 1306 }
1307 SSLClientSocket* ssl_socket = GetSSLClientSocket(); 1307 SSLClientSocket* ssl_socket = GetSSLClientSocket();
1308 ssl_socket->GetSSLInfo(ssl_info); 1308 ssl_socket->GetSSLInfo(ssl_info);
1309 *was_npn_negotiated = ssl_socket->was_npn_negotiated(); 1309 *was_npn_negotiated = ssl_socket->was_npn_negotiated();
1310 *protocol_negotiated = ssl_socket->protocol_negotiated(); 1310 *protocol_negotiated = ssl_socket->GetNegotiatedProtocol();
1311 return true; 1311 return true;
1312 } 1312 }
1313 1313
1314 bool SpdySession::GetSSLCertRequestInfo( 1314 bool SpdySession::GetSSLCertRequestInfo(
1315 SSLCertRequestInfo* cert_request_info) { 1315 SSLCertRequestInfo* cert_request_info) {
1316 if (!is_secure_) 1316 if (!is_secure_)
1317 return false; 1317 return false;
1318 GetSSLClientSocket()->GetSSLCertRequestInfo(cert_request_info); 1318 GetSSLClientSocket()->GetSSLCertRequestInfo(cert_request_info);
1319 return true; 1319 return true;
1320 } 1320 }
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 SSLClientSocket* SpdySession::GetSSLClientSocket() const { 1975 SSLClientSocket* SpdySession::GetSSLClientSocket() const {
1976 if (!is_secure_) 1976 if (!is_secure_)
1977 return NULL; 1977 return NULL;
1978 SSLClientSocket* ssl_socket = 1978 SSLClientSocket* ssl_socket =
1979 reinterpret_cast<SSLClientSocket*>(connection_->socket()); 1979 reinterpret_cast<SSLClientSocket*>(connection_->socket());
1980 DCHECK(ssl_socket); 1980 DCHECK(ssl_socket);
1981 return ssl_socket; 1981 return ssl_socket;
1982 } 1982 }
1983 1983
1984 } // namespace net 1984 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.cc ('k') | remoting/jingle_glue/ssl_socket_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698