| 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 <openssl/ssl.h> |
| 8 |
| 7 #include <utility> | 9 #include <utility> |
| 8 | 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 11 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 12 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/metrics/sparse_histogram.h" | 15 #include "base/metrics/sparse_histogram.h" |
| 14 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
| 15 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 16 #include "base/values.h" | 18 #include "base/values.h" |
| 17 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
| 18 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 19 #include "net/http/http_proxy_client_socket.h" | 21 #include "net/http/http_proxy_client_socket.h" |
| 20 #include "net/http/http_proxy_client_socket_pool.h" | 22 #include "net/http/http_proxy_client_socket_pool.h" |
| 21 #include "net/log/net_log_source_type.h" | 23 #include "net/log/net_log_source_type.h" |
| 22 #include "net/socket/client_socket_factory.h" | 24 #include "net/socket/client_socket_factory.h" |
| 23 #include "net/socket/client_socket_handle.h" | 25 #include "net/socket/client_socket_handle.h" |
| 24 #include "net/socket/socks_client_socket_pool.h" | 26 #include "net/socket/socks_client_socket_pool.h" |
| 25 #include "net/socket/ssl_client_socket.h" | 27 #include "net/socket/ssl_client_socket.h" |
| 26 #include "net/socket/transport_client_socket_pool.h" | 28 #include "net/socket/transport_client_socket_pool.h" |
| 27 #include "net/ssl/ssl_cert_request_info.h" | 29 #include "net/ssl/ssl_cert_request_info.h" |
| 28 #include "net/ssl/ssl_cipher_suite_names.h" | |
| 29 #include "net/ssl/ssl_connection_status_flags.h" | 30 #include "net/ssl/ssl_connection_status_flags.h" |
| 30 #include "net/ssl/ssl_info.h" | 31 #include "net/ssl/ssl_info.h" |
| 31 | 32 |
| 32 namespace net { | 33 namespace net { |
| 33 | 34 |
| 34 SSLSocketParams::SSLSocketParams( | 35 SSLSocketParams::SSLSocketParams( |
| 35 const scoped_refptr<TransportSocketParams>& direct_params, | 36 const scoped_refptr<TransportSocketParams>& direct_params, |
| 36 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params, | 37 const scoped_refptr<SOCKSSocketParams>& socks_proxy_params, |
| 37 const scoped_refptr<HttpProxySocketParams>& http_proxy_params, | 38 const scoped_refptr<HttpProxySocketParams>& http_proxy_params, |
| 38 const HostPortPair& host_and_port, | 39 const HostPortPair& host_and_port, |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 DCHECK(has_ssl_info); | 366 DCHECK(has_ssl_info); |
| 366 | 367 |
| 367 UMA_HISTOGRAM_ENUMERATION("Net.SSLVersion", SSLConnectionStatusToVersion( | 368 UMA_HISTOGRAM_ENUMERATION("Net.SSLVersion", SSLConnectionStatusToVersion( |
| 368 ssl_info.connection_status), | 369 ssl_info.connection_status), |
| 369 SSL_CONNECTION_VERSION_MAX); | 370 SSL_CONNECTION_VERSION_MAX); |
| 370 | 371 |
| 371 uint16_t cipher_suite = | 372 uint16_t cipher_suite = |
| 372 SSLConnectionStatusToCipherSuite(ssl_info.connection_status); | 373 SSLConnectionStatusToCipherSuite(ssl_info.connection_status); |
| 373 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite", cipher_suite); | 374 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_CipherSuite", cipher_suite); |
| 374 | 375 |
| 375 const char *str, *cipher_str, *mac_str; | 376 const SSL_CIPHER* cipher = SSL_get_cipher_by_value(cipher_suite); |
| 376 bool is_aead; | 377 bool is_cecpq1 = cipher && SSL_CIPHER_is_CECPQ1(cipher); |
| 377 bool is_cecpq1 = false; | 378 |
| 378 SSLCipherSuiteToStrings(&str, &cipher_str, &mac_str, &is_aead, | 379 if (ssl_info.key_exchange_group != 0) { |
| 379 cipher_suite); | |
| 380 // UMA_HISTOGRAM_... macros cache the Histogram instance and thus only work | |
| 381 // if the histogram name is constant, so don't generate it dynamically. | |
| 382 if (strncmp(str, "DHE_", 4) == 0) { | |
| 383 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_KeyExchange.DHE", | |
| 384 ssl_info.key_exchange_info); | |
| 385 } else if (strncmp(str, "ECDHE_", 6) == 0) { | |
| 386 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_KeyExchange.ECDHE", | 380 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_KeyExchange.ECDHE", |
| 387 ssl_info.key_exchange_info); | 381 ssl_info.key_exchange_group); |
| 388 } else if (strncmp(str, "CECPQ1_", 7) == 0) { | |
| 389 is_cecpq1 = true; | |
| 390 } else { | |
| 391 DCHECK_EQ(0, strcmp(str, "RSA")); | |
| 392 } | 382 } |
| 393 | 383 |
| 394 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { | 384 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { |
| 395 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake", | 385 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Resume_Handshake", |
| 396 connect_duration, | 386 connect_duration, |
| 397 base::TimeDelta::FromMilliseconds(1), | 387 base::TimeDelta::FromMilliseconds(1), |
| 398 base::TimeDelta::FromMinutes(1), | 388 base::TimeDelta::FromMinutes(1), |
| 399 100); | 389 100); |
| 400 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { | 390 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { |
| 401 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake", | 391 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake", |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 if (base_.CloseOneIdleSocket()) | 683 if (base_.CloseOneIdleSocket()) |
| 694 return true; | 684 return true; |
| 695 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 685 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
| 696 } | 686 } |
| 697 | 687 |
| 698 void SSLClientSocketPool::OnSSLConfigChanged() { | 688 void SSLClientSocketPool::OnSSLConfigChanged() { |
| 699 FlushWithError(ERR_NETWORK_CHANGED); | 689 FlushWithError(ERR_NETWORK_CHANGED); |
| 700 } | 690 } |
| 701 | 691 |
| 702 } // namespace net | 692 } // namespace net |
| OLD | NEW |