OLD | NEW |
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 spdy_sessions.Increment(); | 419 spdy_sessions.Increment(); |
420 | 420 |
421 state_ = CONNECTED; | 421 state_ = CONNECTED; |
422 connection_.reset(connection); | 422 connection_.reset(connection); |
423 is_secure_ = is_secure; | 423 is_secure_ = is_secure; |
424 certificate_error_code_ = certificate_error_code; | 424 certificate_error_code_ = certificate_error_code; |
425 | 425 |
426 NextProto protocol = g_default_protocol; | 426 NextProto protocol = g_default_protocol; |
427 if (is_secure_) { | 427 if (is_secure_) { |
428 SSLClientSocket* ssl_socket = GetSSLClientSocket(); | 428 SSLClientSocket* ssl_socket = GetSSLClientSocket(); |
429 NextProto protocol_negotiated = ssl_socket->protocol_negotiated(); | 429 NextProto protocol_negotiated = ssl_socket->GetNegotiatedProtocol(); |
430 if (protocol_negotiated != kProtoUnknown) { | 430 if (protocol_negotiated != kProtoUnknown) { |
431 protocol = protocol_negotiated; | 431 protocol = protocol_negotiated; |
432 } | 432 } |
433 | 433 |
434 if (ssl_socket->WasDomainBoundCertSent()) { | 434 if (ssl_socket->WasDomainBoundCertSent()) { |
435 // According to the SPDY spec, the credential associated with the TLS | 435 // According to the SPDY spec, the credential associated with the TLS |
436 // connection is stored in slot[1]. | 436 // connection is stored in slot[1]. |
437 credential_state_.SetHasCredential(GURL("https://" + | 437 credential_state_.SetHasCredential(GURL("https://" + |
438 host_port_pair().ToString())); | 438 host_port_pair().ToString())); |
439 } | 439 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 DCHECK(priority >= net::HIGHEST && priority < net::NUM_PRIORITIES); | 614 DCHECK(priority >= net::HIGHEST && priority < net::NUM_PRIORITIES); |
615 | 615 |
616 DCHECK_EQ(active_streams_[stream_id].get(), stream.get()); | 616 DCHECK_EQ(active_streams_[stream_id].get(), stream.get()); |
617 return OK; | 617 return OK; |
618 } | 618 } |
619 | 619 |
620 bool SpdySession::NeedsCredentials() const { | 620 bool SpdySession::NeedsCredentials() const { |
621 if (!is_secure_) | 621 if (!is_secure_) |
622 return false; | 622 return false; |
623 SSLClientSocket* ssl_socket = GetSSLClientSocket(); | 623 SSLClientSocket* ssl_socket = GetSSLClientSocket(); |
624 if (ssl_socket->protocol_negotiated() < kProtoSPDY3) | 624 if (ssl_socket->GetNegotiatedProtocol() < kProtoSPDY3) |
625 return false; | 625 return false; |
626 return ssl_socket->WasDomainBoundCertSent(); | 626 return ssl_socket->WasDomainBoundCertSent(); |
627 } | 627 } |
628 | 628 |
629 void SpdySession::AddPooledAlias(const HostPortProxyPair& alias) { | 629 void SpdySession::AddPooledAlias(const HostPortProxyPair& alias) { |
630 pooled_aliases_.insert(alias); | 630 pooled_aliases_.insert(alias); |
631 } | 631 } |
632 | 632 |
633 int SpdySession::GetProtocolVersion() const { | 633 int SpdySession::GetProtocolVersion() const { |
634 DCHECK(buffered_spdy_framer_.get()); | 634 DCHECK(buffered_spdy_framer_.get()); |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 | 1168 |
1169 dict->SetInteger("active_streams", active_streams_.size()); | 1169 dict->SetInteger("active_streams", active_streams_.size()); |
1170 | 1170 |
1171 dict->SetInteger("unclaimed_pushed_streams", | 1171 dict->SetInteger("unclaimed_pushed_streams", |
1172 unclaimed_pushed_streams_.size()); | 1172 unclaimed_pushed_streams_.size()); |
1173 | 1173 |
1174 dict->SetBoolean("is_secure", is_secure_); | 1174 dict->SetBoolean("is_secure", is_secure_); |
1175 | 1175 |
1176 NextProto proto = kProtoUnknown; | 1176 NextProto proto = kProtoUnknown; |
1177 if (is_secure_) { | 1177 if (is_secure_) { |
1178 proto = GetSSLClientSocket()->protocol_negotiated(); | 1178 proto = GetSSLClientSocket()->GetNegotiatedProtocol(); |
1179 } | 1179 } |
1180 dict->SetString("protocol_negotiated", | 1180 dict->SetString("protocol_negotiated", |
1181 SSLClientSocket::NextProtoToString(proto)); | 1181 SSLClientSocket::NextProtoToString(proto)); |
1182 | 1182 |
1183 dict->SetInteger("error", error_); | 1183 dict->SetInteger("error", error_); |
1184 dict->SetInteger("max_concurrent_streams", max_concurrent_streams_); | 1184 dict->SetInteger("max_concurrent_streams", max_concurrent_streams_); |
1185 | 1185 |
1186 dict->SetInteger("streams_initiated_count", streams_initiated_count_); | 1186 dict->SetInteger("streams_initiated_count", streams_initiated_count_); |
1187 dict->SetInteger("streams_pushed_count", streams_pushed_count_); | 1187 dict->SetInteger("streams_pushed_count", streams_pushed_count_); |
1188 dict->SetInteger("streams_pushed_and_claimed_count", | 1188 dict->SetInteger("streams_pushed_and_claimed_count", |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, | 1276 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, |
1277 bool* was_npn_negotiated, | 1277 bool* was_npn_negotiated, |
1278 NextProto* protocol_negotiated) { | 1278 NextProto* protocol_negotiated) { |
1279 if (!is_secure_) { | 1279 if (!is_secure_) { |
1280 *protocol_negotiated = kProtoUnknown; | 1280 *protocol_negotiated = kProtoUnknown; |
1281 return false; | 1281 return false; |
1282 } | 1282 } |
1283 SSLClientSocket* ssl_socket = GetSSLClientSocket(); | 1283 SSLClientSocket* ssl_socket = GetSSLClientSocket(); |
1284 ssl_socket->GetSSLInfo(ssl_info); | 1284 ssl_socket->GetSSLInfo(ssl_info); |
1285 *was_npn_negotiated = ssl_socket->was_npn_negotiated(); | 1285 *was_npn_negotiated = ssl_socket->was_npn_negotiated(); |
1286 *protocol_negotiated = ssl_socket->protocol_negotiated(); | 1286 *protocol_negotiated = ssl_socket->GetNegotiatedProtocol(); |
1287 return true; | 1287 return true; |
1288 } | 1288 } |
1289 | 1289 |
1290 bool SpdySession::GetSSLCertRequestInfo( | 1290 bool SpdySession::GetSSLCertRequestInfo( |
1291 SSLCertRequestInfo* cert_request_info) { | 1291 SSLCertRequestInfo* cert_request_info) { |
1292 if (!is_secure_) | 1292 if (!is_secure_) |
1293 return false; | 1293 return false; |
1294 GetSSLClientSocket()->GetSSLCertRequestInfo(cert_request_info); | 1294 GetSSLClientSocket()->GetSSLCertRequestInfo(cert_request_info); |
1295 return true; | 1295 return true; |
1296 } | 1296 } |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 SSLClientSocket* SpdySession::GetSSLClientSocket() const { | 1946 SSLClientSocket* SpdySession::GetSSLClientSocket() const { |
1947 if (!is_secure_) | 1947 if (!is_secure_) |
1948 return NULL; | 1948 return NULL; |
1949 SSLClientSocket* ssl_socket = | 1949 SSLClientSocket* ssl_socket = |
1950 reinterpret_cast<SSLClientSocket*>(connection_->socket()); | 1950 reinterpret_cast<SSLClientSocket*>(connection_->socket()); |
1951 DCHECK(ssl_socket); | 1951 DCHECK(ssl_socket); |
1952 return ssl_socket; | 1952 return ssl_socket; |
1953 } | 1953 } |
1954 | 1954 |
1955 } // namespace net | 1955 } // namespace net |
OLD | NEW |