| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/socket/ssl_client_socket_pool.h" | 5 #include "net/socket/ssl_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 ssl_socket_.reset(client_socket_factory_->CreateSSLClientSocket( | 279 ssl_socket_.reset(client_socket_factory_->CreateSSLClientSocket( |
| 280 transport_socket_handle_.release(), params_->host_and_port(), | 280 transport_socket_handle_.release(), params_->host_and_port(), |
| 281 params_->ssl_config(), ssl_host_info_.release(), context_)); | 281 params_->ssl_config(), ssl_host_info_.release(), context_)); |
| 282 return ssl_socket_->Connect(&callback_); | 282 return ssl_socket_->Connect(&callback_); |
| 283 } | 283 } |
| 284 | 284 |
| 285 int SSLConnectJob::DoSSLConnectComplete(int result) { | 285 int SSLConnectJob::DoSSLConnectComplete(int result) { |
| 286 SSLClientSocket::NextProtoStatus status = | 286 SSLClientSocket::NextProtoStatus status = |
| 287 SSLClientSocket::kNextProtoUnsupported; | 287 SSLClientSocket::kNextProtoUnsupported; |
| 288 std::string proto; | 288 std::string proto; |
| 289 std::string server_proto; |
| 289 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket | 290 // GetNextProto will fail and and trigger a NOTREACHED if we pass in a socket |
| 290 // that hasn't had SSL_ImportFD called on it. If we get a certificate error | 291 // that hasn't had SSL_ImportFD called on it. If we get a certificate error |
| 291 // here, then we know that we called SSL_ImportFD. | 292 // here, then we know that we called SSL_ImportFD. |
| 292 if (result == OK || IsCertificateError(result)) | 293 if (result == OK || IsCertificateError(result)) |
| 293 status = ssl_socket_->GetNextProto(&proto); | 294 status = ssl_socket_->GetNextProto(&proto, &server_proto); |
| 294 | 295 |
| 295 // If we want spdy over npn, make sure it succeeded. | 296 // If we want spdy over npn, make sure it succeeded. |
| 296 if (status == SSLClientSocket::kNextProtoNegotiated) { | 297 if (status == SSLClientSocket::kNextProtoNegotiated) { |
| 297 ssl_socket_->set_was_npn_negotiated(true); | 298 ssl_socket_->set_was_npn_negotiated(true); |
| 298 SSLClientSocket::NextProto next_protocol = | 299 SSLClientSocket::NextProto next_protocol = |
| 299 SSLClientSocket::NextProtoFromString(proto); | 300 SSLClientSocket::NextProtoFromString(proto); |
| 300 // If we negotiated either version of SPDY, we must have | 301 // If we negotiated either version of SPDY, we must have |
| 301 // advertised it, so allow it. | 302 // advertised it, so allow it. |
| 302 // TODO(mbelshe): verify it was a protocol we advertised? | 303 // TODO(mbelshe): verify it was a protocol we advertised? |
| 303 if (next_protocol == SSLClientSocket::kProtoSPDY1 || | 304 if (next_protocol == SSLClientSocket::kProtoSPDY1 || |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 583 |
| 583 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const { | 584 ClientSocketPoolHistograms* SSLClientSocketPool::histograms() const { |
| 584 return base_.histograms(); | 585 return base_.histograms(); |
| 585 } | 586 } |
| 586 | 587 |
| 587 void SSLClientSocketPool::OnSSLConfigChanged() { | 588 void SSLClientSocketPool::OnSSLConfigChanged() { |
| 588 Flush(); | 589 Flush(); |
| 589 } | 590 } |
| 590 | 591 |
| 591 } // namespace net | 592 } // namespace net |
| OLD | NEW |