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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 connection_attempts_.push_back(ConnectionAttempt(server_address_, result)); | 339 connection_attempts_.push_back(ConnectionAttempt(server_address_, result)); |
340 server_address_ = IPEndPoint(); | 340 server_address_ = IPEndPoint(); |
341 } | 341 } |
342 | 342 |
343 // If we want SPDY over ALPN, make sure it succeeded. | 343 // If we want SPDY over ALPN, make sure it succeeded. |
344 if (params_->expect_spdy() && | 344 if (params_->expect_spdy() && |
345 ssl_socket_->GetNegotiatedProtocol() != kProtoHTTP2) { | 345 ssl_socket_->GetNegotiatedProtocol() != kProtoHTTP2) { |
346 return ERR_ALPN_NEGOTIATION_FAILED; | 346 return ERR_ALPN_NEGOTIATION_FAILED; |
347 } | 347 } |
348 | 348 |
349 const std::string& host = params_->host_and_port().host(); | |
350 bool is_google = | |
351 host == "google.com" || | |
352 (host.size() > 11 && host.rfind(".google.com") == host.size() - 11); | |
353 | |
354 // These are hosts that we expect to always offer TLS 1.3 Connections to | |
davidben
2017/03/07 19:51:13
Period after TLS 1.3.
svaldez
2017/03/07 20:06:59
Done.
| |
355 // them, whether or not this browser is in the experiment group, form the | |
356 // basis of our comparisons. | |
davidben
2017/03/07 19:51:13
Not sure if this comment is true yet. Perhaps:
Th
svaldez
2017/03/07 20:06:59
Done.
| |
357 bool tls13_supported = | |
358 (host == "drive.google.com" || host == "mail.google.com"); | |
359 | |
349 if (result == OK || | 360 if (result == OK || |
350 ssl_socket_->IgnoreCertError(result, params_->load_flags())) { | 361 ssl_socket_->IgnoreCertError(result, params_->load_flags())) { |
351 DCHECK(!connect_timing_.ssl_start.is_null()); | 362 DCHECK(!connect_timing_.ssl_start.is_null()); |
352 base::TimeDelta connect_duration = | 363 base::TimeDelta connect_duration = |
353 connect_timing_.ssl_end - connect_timing_.ssl_start; | 364 connect_timing_.ssl_end - connect_timing_.ssl_start; |
354 if (params_->expect_spdy()) { | 365 if (params_->expect_spdy()) { |
355 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2", | 366 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency_2", |
356 connect_duration, | 367 connect_duration, |
357 base::TimeDelta::FromMilliseconds(1), | 368 base::TimeDelta::FromMilliseconds(1), |
358 base::TimeDelta::FromMinutes(1), | 369 base::TimeDelta::FromMinutes(1), |
(...skipping 30 matching lines...) Expand all Loading... | |
389 base::TimeDelta::FromMinutes(1), | 400 base::TimeDelta::FromMinutes(1), |
390 100); | 401 100); |
391 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { | 402 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { |
392 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake", | 403 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Full_Handshake", |
393 connect_duration, | 404 connect_duration, |
394 base::TimeDelta::FromMilliseconds(1), | 405 base::TimeDelta::FromMilliseconds(1), |
395 base::TimeDelta::FromMinutes(1), | 406 base::TimeDelta::FromMinutes(1), |
396 100); | 407 100); |
397 } | 408 } |
398 | 409 |
399 const std::string& host = params_->host_and_port().host(); | |
400 bool is_google = | |
401 host == "google.com" || | |
402 (host.size() > 11 && host.rfind(".google.com") == host.size() - 11); | |
403 if (is_google) { | 410 if (is_google) { |
404 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google2", | 411 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google2", |
405 connect_duration, | 412 connect_duration, |
406 base::TimeDelta::FromMilliseconds(1), | 413 base::TimeDelta::FromMilliseconds(1), |
407 base::TimeDelta::FromMinutes(1), | 414 base::TimeDelta::FromMinutes(1), |
408 100); | 415 100); |
409 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { | 416 if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_RESUME) { |
410 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_" | 417 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_" |
411 "Resume_Handshake", | 418 "Resume_Handshake", |
412 connect_duration, | 419 connect_duration, |
413 base::TimeDelta::FromMilliseconds(1), | 420 base::TimeDelta::FromMilliseconds(1), |
414 base::TimeDelta::FromMinutes(1), | 421 base::TimeDelta::FromMinutes(1), |
415 100); | 422 100); |
416 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { | 423 } else if (ssl_info.handshake_type == SSLInfo::HANDSHAKE_FULL) { |
417 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_" | 424 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google_" |
418 "Full_Handshake", | 425 "Full_Handshake", |
419 connect_duration, | 426 connect_duration, |
420 base::TimeDelta::FromMilliseconds(1), | 427 base::TimeDelta::FromMilliseconds(1), |
421 base::TimeDelta::FromMinutes(1), | 428 base::TimeDelta::FromMinutes(1), |
422 100); | 429 100); |
423 } | 430 } |
424 } | 431 } |
432 | |
433 if (tls13_supported) { | |
434 UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_TLS13", | |
davidben
2017/03/07 19:51:13
TLS13 is going to get confusing in the future sinc
svaldez
2017/03/07 20:06:59
Done.
| |
435 connect_duration, | |
436 base::TimeDelta::FromMilliseconds(1), | |
437 base::TimeDelta::FromMinutes(1), 100); | |
438 } | |
425 } | 439 } |
426 | 440 |
427 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(result)); | 441 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(result)); |
428 | 442 |
443 if (is_google) { | |
444 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error_Google", | |
445 std::abs(result)); | |
446 } | |
447 | |
448 if (tls13_supported) { | |
449 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error_TLS13", | |
davidben
2017/03/07 19:51:13
Ditto.
svaldez
2017/03/07 20:06:59
Done.
svaldez
2017/03/07 20:06:59
Done.
| |
450 std::abs(result)); | |
451 } | |
452 | |
429 if (result == OK || IsCertificateError(result)) { | 453 if (result == OK || IsCertificateError(result)) { |
430 SetSocket(std::move(ssl_socket_)); | 454 SetSocket(std::move(ssl_socket_)); |
431 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 455 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
432 error_response_info_.cert_request_info = new SSLCertRequestInfo; | 456 error_response_info_.cert_request_info = new SSLCertRequestInfo; |
433 ssl_socket_->GetSSLCertRequestInfo( | 457 ssl_socket_->GetSSLCertRequestInfo( |
434 error_response_info_.cert_request_info.get()); | 458 error_response_info_.cert_request_info.get()); |
435 } | 459 } |
436 | 460 |
437 return result; | 461 return result; |
438 } | 462 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 if (base_.CloseOneIdleSocket()) | 703 if (base_.CloseOneIdleSocket()) |
680 return true; | 704 return true; |
681 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 705 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
682 } | 706 } |
683 | 707 |
684 void SSLClientSocketPool::OnSSLConfigChanged() { | 708 void SSLClientSocketPool::OnSSLConfigChanged() { |
685 FlushWithError(ERR_NETWORK_CHANGED); | 709 FlushWithError(ERR_NETWORK_CHANGED); |
686 } | 710 } |
687 | 711 |
688 } // namespace net | 712 } // namespace net |
OLD | NEW |