| Index: net/socket/ssl_client_socket.cc
|
| diff --git a/net/socket/ssl_client_socket.cc b/net/socket/ssl_client_socket.cc
|
| index 4aacbc8d42db5faa1f4eb25cad3588efb37b752f..da2d6ba0c8d8a88fabe6ba53519e0b69f07e5926 100644
|
| --- a/net/socket/ssl_client_socket.cc
|
| +++ b/net/socket/ssl_client_socket.cc
|
| @@ -5,6 +5,7 @@
|
| #include "net/socket/ssl_client_socket.h"
|
|
|
| #include "base/metrics/histogram.h"
|
| +#include "base/metrics/sparse_histogram.h"
|
| #include "base/strings/string_util.h"
|
| #include "crypto/ec_private_key.h"
|
| #include "net/base/host_port_pair.h"
|
| @@ -19,7 +20,8 @@ SSLClientSocket::SSLClientSocket()
|
| protocol_negotiated_(kProtoUnknown),
|
| channel_id_sent_(false),
|
| signed_cert_timestamps_received_(false),
|
| - stapled_ocsp_response_received_(false) {
|
| + stapled_ocsp_response_received_(false),
|
| + negotiation_extension_(kExtensionUnknown) {
|
| }
|
|
|
| // static
|
| @@ -124,6 +126,11 @@ void SSLClientSocket::set_protocol_negotiated(NextProto protocol_negotiated) {
|
| protocol_negotiated_ = protocol_negotiated;
|
| }
|
|
|
| +void SSLClientSocket::set_negotiation_extension(
|
| + SSLNegotiationExtension negotiation_extension) {
|
| + negotiation_extension_ = negotiation_extension;
|
| +}
|
| +
|
| bool SSLClientSocket::WasChannelIDSent() const {
|
| return channel_id_sent_;
|
| }
|
| @@ -232,4 +239,30 @@ std::vector<uint8_t> SSLClientSocket::SerializeNextProtos(
|
| return wire_protos;
|
| }
|
|
|
| +void SSLClientSocket::RecordNegotiationExtension() {
|
| + if (negotiation_extension_ == kExtensionUnknown)
|
| + return;
|
| + std::string proto;
|
| + SSLClientSocket::NextProtoStatus status = GetNextProto(&proto);
|
| + if (status == kNextProtoUnsupported)
|
| + return;
|
| + // Convert protocol into numerical value for histogram.
|
| + NextProto protocol_negotiated = SSLClientSocket::NextProtoFromString(proto);
|
| + base::HistogramBase::Sample sample =
|
| + static_cast<base::HistogramBase::Sample>(protocol_negotiated);
|
| + // In addition to the protocol negotiated, we want to record which TLS
|
| + // extension was used, and in case of NPN, whether there was overlap between
|
| + // server and client list of supported protocols.
|
| + if (negotiation_extension_ == kExtensionNPN) {
|
| + if (status == kNextProtoNoOverlap) {
|
| + sample += 1000;
|
| + } else {
|
| + sample += 500;
|
| + }
|
| + } else {
|
| + DCHECK_EQ(kExtensionALPN, negotiation_extension_);
|
| + }
|
| + UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample);
|
| +}
|
| +
|
| } // namespace net
|
|
|