Chromium Code Reviews| 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 // OpenSSL binding for SSLClientSocket. The class layout and general principle | 5 // OpenSSL binding for SSLClientSocket. The class layout and general principle |
| 6 // of operation is derived from SSLClientSocketNSS. | 6 // of operation is derived from SSLClientSocketNSS. |
| 7 | 7 |
| 8 #include "net/socket/ssl_client_socket_openssl.h" | 8 #include "net/socket/ssl_client_socket_openssl.h" |
| 9 | 9 |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 // TransportSecurityState. | 467 // TransportSecurityState. |
| 468 DCHECK(transport_security_state_); | 468 DCHECK(transport_security_state_); |
| 469 | 469 |
| 470 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT); | 470 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT); |
| 471 | 471 |
| 472 // Set up new ssl object. | 472 // Set up new ssl object. |
| 473 int rv = Init(); | 473 int rv = Init(); |
| 474 if (rv != OK) { | 474 if (rv != OK) { |
| 475 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); | 475 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); |
| 476 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(rv)); | 476 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(rv)); |
| 477 if (ssl_config_.fastradio_padding_eligible) | |
| 478 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error_ClientPadding", | |
| 479 std::abs(rv)); | |
|
davidben
2015/02/04 01:04:47
It looks like SSL_Connection_Error metrics were ad
jeremyim
2015/02/04 17:26:32
We were planning on using the latency metrics from
davidben
2015/02/04 17:44:36
SSL_Connection_Error is extremely generic and isn'
| |
| 477 return rv; | 480 return rv; |
| 478 } | 481 } |
| 479 | 482 |
| 480 // Set SSL to client mode. Handshake happens in the loop below. | 483 // Set SSL to client mode. Handshake happens in the loop below. |
| 481 SSL_set_connect_state(ssl_); | 484 SSL_set_connect_state(ssl_); |
| 482 | 485 |
| 486 // Enable fastradio padding. | |
| 487 SSL_enable_fastradio_padding(ssl_, | |
| 488 ssl_config_.enable_fastradio_padding && | |
| 489 ssl_config_.fastradio_padding_eligible); | |
| 490 | |
| 483 GotoState(STATE_HANDSHAKE); | 491 GotoState(STATE_HANDSHAKE); |
| 484 rv = DoHandshakeLoop(OK); | 492 rv = DoHandshakeLoop(OK); |
| 485 if (rv == ERR_IO_PENDING) { | 493 if (rv == ERR_IO_PENDING) { |
| 486 user_connect_callback_ = callback; | 494 user_connect_callback_ = callback; |
| 487 } else { | 495 } else { |
| 488 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); | 496 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); |
| 489 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(rv)); | 497 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(rv)); |
| 498 if (ssl_config_.fastradio_padding_eligible) | |
| 499 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error_ClientPadding", | |
| 500 std::abs(rv)); | |
| 490 if (rv < OK) | 501 if (rv < OK) |
| 491 OnHandshakeCompletion(); | 502 OnHandshakeCompletion(); |
| 492 } | 503 } |
| 493 | 504 |
| 494 return rv > OK ? OK : rv; | 505 return rv > OK ? OK : rv; |
| 495 } | 506 } |
| 496 | 507 |
| 497 void SSLClientSocketOpenSSL::Disconnect() { | 508 void SSLClientSocketOpenSSL::Disconnect() { |
| 498 // If a handshake was pending (Connect() had been called), notify interested | 509 // If a handshake was pending (Connect() had been called), notify interested |
| 499 // parties that it's been aborted now. If the handshake had already | 510 // parties that it's been aborted now. If the handshake had already |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1360 } | 1371 } |
| 1361 } | 1372 } |
| 1362 } | 1373 } |
| 1363 } | 1374 } |
| 1364 | 1375 |
| 1365 void SSLClientSocketOpenSSL::OnHandshakeIOComplete(int result) { | 1376 void SSLClientSocketOpenSSL::OnHandshakeIOComplete(int result) { |
| 1366 int rv = DoHandshakeLoop(result); | 1377 int rv = DoHandshakeLoop(result); |
| 1367 if (rv != ERR_IO_PENDING) { | 1378 if (rv != ERR_IO_PENDING) { |
| 1368 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); | 1379 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_SSL_CONNECT, rv); |
| 1369 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(rv)); | 1380 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error", std::abs(rv)); |
| 1381 if (ssl_config_.fastradio_padding_eligible) | |
| 1382 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSL_Connection_Error_ClientPadding", | |
| 1383 std::abs(rv)); | |
| 1370 DoConnectCallback(rv); | 1384 DoConnectCallback(rv); |
| 1371 } | 1385 } |
| 1372 } | 1386 } |
| 1373 | 1387 |
| 1374 void SSLClientSocketOpenSSL::OnSendComplete(int result) { | 1388 void SSLClientSocketOpenSSL::OnSendComplete(int result) { |
| 1375 if (next_handshake_state_ == STATE_HANDSHAKE) { | 1389 if (next_handshake_state_ == STATE_HANDSHAKE) { |
| 1376 // In handshake phase. | 1390 // In handshake phase. |
| 1377 OnHandshakeIOComplete(result); | 1391 OnHandshakeIOComplete(result); |
| 1378 return; | 1392 return; |
| 1379 } | 1393 } |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2023 ct::SCT_STATUS_LOG_UNKNOWN)); | 2037 ct::SCT_STATUS_LOG_UNKNOWN)); |
| 2024 } | 2038 } |
| 2025 } | 2039 } |
| 2026 | 2040 |
| 2027 scoped_refptr<X509Certificate> | 2041 scoped_refptr<X509Certificate> |
| 2028 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { | 2042 SSLClientSocketOpenSSL::GetUnverifiedServerCertificateChain() const { |
| 2029 return server_cert_; | 2043 return server_cert_; |
| 2030 } | 2044 } |
| 2031 | 2045 |
| 2032 } // namespace net | 2046 } // namespace net |
| OLD | NEW |