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

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

Issue 2243453002: Replace SSLProtocolNegotiation histogram with SSLNegotiatedAlpnProtocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #18. Created 4 years, 3 months 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
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_impl.h" 5 #include "net/socket/ssl_client_socket_impl.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <openssl/bio.h> 8 #include <openssl/bio.h>
9 #include <openssl/bytestring.h> 9 #include <openssl/bytestring.h>
10 #include <openssl/err.h> 10 #include <openssl/err.h>
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 SSL_get0_alpn_selected(ssl_, &alpn_proto, &alpn_len); 1207 SSL_get0_alpn_selected(ssl_, &alpn_proto, &alpn_len);
1208 if (alpn_len > 0) { 1208 if (alpn_len > 0) {
1209 base::StringPiece proto(reinterpret_cast<const char*>(alpn_proto), 1209 base::StringPiece proto(reinterpret_cast<const char*>(alpn_proto),
1210 alpn_len); 1210 alpn_len);
1211 negotiated_protocol_ = NextProtoFromString(proto); 1211 negotiated_protocol_ = NextProtoFromString(proto);
1212 npn_status_ = kNextProtoNegotiated; 1212 npn_status_ = kNextProtoNegotiated;
1213 negotiation_extension_ = kExtensionALPN; 1213 negotiation_extension_ = kExtensionALPN;
1214 } 1214 }
1215 } 1215 }
1216 1216
1217 RecordNegotiationExtension(); 1217 RecordNegotiatedProtocol();
1218 RecordChannelIDSupport(); 1218 RecordChannelIDSupport();
1219 1219
1220 const uint8_t* ocsp_response_raw; 1220 const uint8_t* ocsp_response_raw;
1221 size_t ocsp_response_len; 1221 size_t ocsp_response_len;
1222 SSL_get0_ocsp_response(ssl_, &ocsp_response_raw, &ocsp_response_len); 1222 SSL_get0_ocsp_response(ssl_, &ocsp_response_raw, &ocsp_response_len);
1223 std::string ocsp_response; 1223 std::string ocsp_response;
1224 if (ocsp_response_len > 0) { 1224 if (ocsp_response_len > 0) {
1225 ocsp_response_.assign(reinterpret_cast<const char*>(ocsp_response_raw), 1225 ocsp_response_.assign(reinterpret_cast<const char*>(ocsp_response_raw),
1226 ocsp_response_len); 1226 ocsp_response_len);
1227 } 1227 }
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 void SSLClientSocketImpl::LogConnectEndEvent(int rv) { 2331 void SSLClientSocketImpl::LogConnectEndEvent(int rv) {
2332 if (rv != OK) { 2332 if (rv != OK) {
2333 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); 2333 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv);
2334 return; 2334 return;
2335 } 2335 }
2336 2336
2337 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, 2337 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT,
2338 base::Bind(&NetLogSSLInfoCallback, base::Unretained(this))); 2338 base::Bind(&NetLogSSLInfoCallback, base::Unretained(this)));
2339 } 2339 }
2340 2340
2341 void SSLClientSocketImpl::RecordNegotiationExtension() const { 2341 void SSLClientSocketImpl::RecordNegotiatedProtocol() const {
2342 if (negotiation_extension_ == kExtensionUnknown) 2342 UMA_HISTOGRAM_ENUMERATION("SSL.AlpnNegotiatedProtocol", negotiated_protocol_,
davidben 2016/08/27 02:27:58 We don't have much UMA that starts with "SSL." It'
Bence 2016/08/29 12:54:33 I'm sorry, I have misunderstood your earlier comme
2343 return; 2343 kProtoNumberOfNextProtos);
2344 if (npn_status_ == kNextProtoUnsupported)
2345 return;
2346 base::HistogramBase::Sample sample =
2347 static_cast<base::HistogramBase::Sample>(negotiated_protocol_);
2348 // In addition to the protocol negotiated, we want to record which TLS
2349 // extension was used, and in case of NPN, whether there was overlap between
2350 // server and client list of supported protocols.
2351 if (negotiation_extension_ == kExtensionNPN) {
2352 if (npn_status_ == kNextProtoNoOverlap) {
2353 sample += 1000;
2354 } else {
2355 sample += 500;
2356 }
2357 } else {
2358 DCHECK_EQ(kExtensionALPN, negotiation_extension_);
2359 }
2360 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample);
2361 } 2344 }
2362 2345
2363 void SSLClientSocketImpl::RecordChannelIDSupport() const { 2346 void SSLClientSocketImpl::RecordChannelIDSupport() const {
2364 // Since this enum is used for a histogram, do not change or re-use values. 2347 // Since this enum is used for a histogram, do not change or re-use values.
2365 enum { 2348 enum {
2366 DISABLED = 0, 2349 DISABLED = 0,
2367 CLIENT_ONLY = 1, 2350 CLIENT_ONLY = 1,
2368 CLIENT_AND_SERVER = 2, 2351 CLIENT_AND_SERVER = 2,
2369 // CLIENT_NO_ECC is unused now. 2352 // CLIENT_NO_ECC is unused now.
2370 // CLIENT_BAD_SYSTEM_TIME is unused now. 2353 // CLIENT_BAD_SYSTEM_TIME is unused now.
(...skipping 11 matching lines...) Expand all
2382 } 2365 }
2383 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported, 2366 UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.Support", supported,
2384 CHANNEL_ID_USAGE_MAX); 2367 CHANNEL_ID_USAGE_MAX);
2385 } 2368 }
2386 2369
2387 bool SSLClientSocketImpl::IsChannelIDEnabled() const { 2370 bool SSLClientSocketImpl::IsChannelIDEnabled() const {
2388 return ssl_config_.channel_id_enabled && channel_id_service_; 2371 return ssl_config_.channel_id_enabled && channel_id_service_;
2389 } 2372 }
2390 2373
2391 } // namespace net 2374 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698