| 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/socket/ssl_client_socket_pool.h" | 5 #include "net/socket/ssl_client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // here, then we know that we called SSL_ImportFD. | 294 // here, then we know that we called SSL_ImportFD. |
| 295 if (result == OK || IsCertificateError(result)) | 295 if (result == OK || IsCertificateError(result)) |
| 296 status = ssl_socket_->GetNextProto(&proto, &server_protos); | 296 status = ssl_socket_->GetNextProto(&proto, &server_protos); |
| 297 | 297 |
| 298 // If we want spdy over npn, make sure it succeeded. | 298 // If we want spdy over npn, make sure it succeeded. |
| 299 if (status == SSLClientSocket::kNextProtoNegotiated) { | 299 if (status == SSLClientSocket::kNextProtoNegotiated) { |
| 300 ssl_socket_->set_was_npn_negotiated(true); | 300 ssl_socket_->set_was_npn_negotiated(true); |
| 301 NextProto protocol_negotiated = | 301 NextProto protocol_negotiated = |
| 302 SSLClientSocket::NextProtoFromString(proto); | 302 SSLClientSocket::NextProtoFromString(proto); |
| 303 ssl_socket_->set_protocol_negotiated(protocol_negotiated); | 303 ssl_socket_->set_protocol_negotiated(protocol_negotiated); |
| 304 // If we negotiated either version of SPDY, we must have | 304 // If we negotiated a SPDY version, it must have been present in |
| 305 // advertised it, so allow it. | 305 // SSLConfig::next_protos. |
| 306 // TODO(mbelshe): verify it was a protocol we advertised? | 306 // TODO(mbelshe): Verify this. |
| 307 if (protocol_negotiated == kProtoSPDY1 || | 307 if (protocol_negotiated >= kProtoSPDYMinimumVersion && |
| 308 protocol_negotiated == kProtoSPDY2 || | 308 protocol_negotiated <= kProtoSPDYMaximumVersion) { |
| 309 protocol_negotiated == kProtoSPDY3) { | |
| 310 ssl_socket_->set_was_spdy_negotiated(true); | 309 ssl_socket_->set_was_spdy_negotiated(true); |
| 311 } | 310 } |
| 312 } | 311 } |
| 313 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated()) | 312 if (params_->want_spdy_over_npn() && !ssl_socket_->was_spdy_negotiated()) |
| 314 return ERR_NPN_NEGOTIATION_FAILED; | 313 return ERR_NPN_NEGOTIATION_FAILED; |
| 315 | 314 |
| 316 // Spdy might be turned on by default, or it might be over npn. | 315 // Spdy might be turned on by default, or it might be over npn. |
| 317 bool using_spdy = params_->force_spdy_over_ssl() || | 316 bool using_spdy = params_->force_spdy_over_ssl() || |
| 318 params_->want_spdy_over_npn(); | 317 params_->want_spdy_over_npn(); |
| 319 | 318 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 FlushWithError(ERR_NETWORK_CHANGED); | 622 FlushWithError(ERR_NETWORK_CHANGED); |
| 624 } | 623 } |
| 625 | 624 |
| 626 bool SSLClientSocketPool::CloseOneIdleConnection() { | 625 bool SSLClientSocketPool::CloseOneIdleConnection() { |
| 627 if (base_.CloseOneIdleSocket()) | 626 if (base_.CloseOneIdleSocket()) |
| 628 return true; | 627 return true; |
| 629 return base_.CloseOneIdleConnectionInLayeredPool(); | 628 return base_.CloseOneIdleConnectionInLayeredPool(); |
| 630 } | 629 } |
| 631 | 630 |
| 632 } // namespace net | 631 } // namespace net |
| OLD | NEW |