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

Side by Side Diff: net/socket/ssl_client_socket.cc

Issue 698283003: Record ConnectionType metrics in OpenSSL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | net/socket/ssl_client_socket_nss.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/socket/ssl_client_socket.h" 5 #include "net/socket/ssl_client_socket.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "crypto/ec_private_key.h" 10 #include "crypto/ec_private_key.h"
11 #include "net/base/connection_type_histograms.h"
11 #include "net/base/host_port_pair.h" 12 #include "net/base/host_port_pair.h"
12 #include "net/ssl/channel_id_service.h" 13 #include "net/ssl/channel_id_service.h"
13 #include "net/ssl/ssl_config_service.h" 14 #include "net/ssl/ssl_config_service.h"
15 #include "net/ssl/ssl_connection_status_flags.h"
14 16
15 namespace net { 17 namespace net {
16 18
17 SSLClientSocket::SSLClientSocket() 19 SSLClientSocket::SSLClientSocket()
18 : was_npn_negotiated_(false), 20 : was_npn_negotiated_(false),
19 was_spdy_negotiated_(false), 21 was_spdy_negotiated_(false),
20 protocol_negotiated_(kProtoUnknown), 22 protocol_negotiated_(kProtoUnknown),
21 channel_id_sent_(false), 23 channel_id_sent_(false),
22 signed_cert_timestamps_received_(false), 24 signed_cert_timestamps_received_(false),
23 stapled_ocsp_response_received_(false), 25 stapled_ocsp_response_received_(false),
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 else if (!channel_id_service->IsSystemTimeValid()) 177 else if (!channel_id_service->IsSystemTimeValid())
176 supported = CLIENT_BAD_SYSTEM_TIME; 178 supported = CLIENT_BAD_SYSTEM_TIME;
177 else 179 else
178 supported = CLIENT_ONLY; 180 supported = CLIENT_ONLY;
179 } 181 }
180 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported, 182 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported,
181 CHANNEL_ID_USAGE_MAX); 183 CHANNEL_ID_USAGE_MAX);
182 } 184 }
183 185
184 // static 186 // static
187 void SSLClientSocket::RecordConnectionTypeMetrics(int ssl_version) {
188 UpdateConnectionTypeHistograms(CONNECTION_SSL);
189 switch (ssl_version) {
190 case SSL_CONNECTION_VERSION_SSL2:
191 UpdateConnectionTypeHistograms(CONNECTION_SSL_SSL2);
192 break;
193 case SSL_CONNECTION_VERSION_SSL3:
194 UpdateConnectionTypeHistograms(CONNECTION_SSL_SSL3);
195 break;
196 case SSL_CONNECTION_VERSION_TLS1:
197 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1);
198 break;
199 case SSL_CONNECTION_VERSION_TLS1_1:
200 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_1);
201 break;
202 case SSL_CONNECTION_VERSION_TLS1_2:
203 UpdateConnectionTypeHistograms(CONNECTION_SSL_TLS1_2);
204 break;
205 }
206 }
207
208 // static
185 bool SSLClientSocket::IsChannelIDEnabled( 209 bool SSLClientSocket::IsChannelIDEnabled(
186 const SSLConfig& ssl_config, 210 const SSLConfig& ssl_config,
187 ChannelIDService* channel_id_service) { 211 ChannelIDService* channel_id_service) {
188 if (!ssl_config.channel_id_enabled) 212 if (!ssl_config.channel_id_enabled)
189 return false; 213 return false;
190 if (!channel_id_service) { 214 if (!channel_id_service) {
191 DVLOG(1) << "NULL channel_id_service_, not enabling channel ID."; 215 DVLOG(1) << "NULL channel_id_service_, not enabling channel ID.";
192 return false; 216 return false;
193 } 217 }
194 if (!crypto::ECPrivateKey::IsSupported()) { 218 if (!crypto::ECPrivateKey::IsSupported()) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } else { 283 } else {
260 sample += 500; 284 sample += 500;
261 } 285 }
262 } else { 286 } else {
263 DCHECK_EQ(kExtensionALPN, negotiation_extension_); 287 DCHECK_EQ(kExtensionALPN, negotiation_extension_);
264 } 288 }
265 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); 289 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample);
266 } 290 }
267 291
268 } // namespace net 292 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698