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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 // by the endpoint host, request_->url, rather than considering if they were | 1351 // by the endpoint host, request_->url, rather than considering if they were |
1352 // generated by the SSL proxy. http://crbug.com/69329 | 1352 // generated by the SSL proxy. http://crbug.com/69329 |
1353 int HttpNetworkTransaction::HandleSSLHandshakeError(int error) { | 1353 int HttpNetworkTransaction::HandleSSLHandshakeError(int error) { |
1354 DCHECK(request_); | 1354 DCHECK(request_); |
1355 HandleClientAuthError(error); | 1355 HandleClientAuthError(error); |
1356 | 1356 |
1357 bool should_fallback = false; | 1357 bool should_fallback = false; |
1358 uint16 version_max = server_ssl_config_.version_max; | 1358 uint16 version_max = server_ssl_config_.version_max; |
1359 | 1359 |
1360 switch (error) { | 1360 switch (error) { |
| 1361 case ERR_CONNECTION_CLOSED: |
1361 case ERR_SSL_PROTOCOL_ERROR: | 1362 case ERR_SSL_PROTOCOL_ERROR: |
1362 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: | 1363 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: |
1363 if (version_max >= SSL_PROTOCOL_VERSION_TLS1 && | 1364 if (version_max >= SSL_PROTOCOL_VERSION_TLS1 && |
1364 version_max > server_ssl_config_.version_min) { | 1365 version_max > server_ssl_config_.version_min) { |
1365 // This could be a TLS-intolerant server or a server that chose a | 1366 // This could be a TLS-intolerant server or a server that chose a |
1366 // cipher suite defined only for higher protocol versions (such as | 1367 // cipher suite defined only for higher protocol versions (such as |
1367 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall | 1368 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall |
1368 // back to the next lower version and retry. | 1369 // back to the next lower version and retry. |
1369 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, | 1370 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, |
1370 // specifying TLS 1.1 in version_max will result in a TLS 1.0 | 1371 // specifying TLS 1.1 in version_max will result in a TLS 1.0 |
(...skipping 14 matching lines...) Expand all Loading... |
1385 if (version_max >= SSL_PROTOCOL_VERSION_TLS1_1 && | 1386 if (version_max >= SSL_PROTOCOL_VERSION_TLS1_1 && |
1386 version_max > server_ssl_config_.version_min) { | 1387 version_max > server_ssl_config_.version_min) { |
1387 // Some broken SSL devices negotiate TLS 1.0 when sent a TLS 1.1 or | 1388 // Some broken SSL devices negotiate TLS 1.0 when sent a TLS 1.1 or |
1388 // 1.2 ClientHello, but then return a bad_record_mac alert. See | 1389 // 1.2 ClientHello, but then return a bad_record_mac alert. See |
1389 // crbug.com/260358. In order to make the fallback as minimal as | 1390 // crbug.com/260358. In order to make the fallback as minimal as |
1390 // possible, this fallback is only triggered for >= TLS 1.1. | 1391 // possible, this fallback is only triggered for >= TLS 1.1. |
1391 version_max--; | 1392 version_max--; |
1392 should_fallback = true; | 1393 should_fallback = true; |
1393 } | 1394 } |
1394 break; | 1395 break; |
| 1396 case ERR_CONNECTION_RESET: |
| 1397 if (version_max >= SSL_PROTOCOL_VERSION_TLS1_1 && |
| 1398 version_max > server_ssl_config_.version_min) { |
| 1399 // Some network devices that inspect application-layer packets seem to |
| 1400 // inject TCP reset packets to break the connections when they see TLS |
| 1401 // 1.1 in ClientHello or ServerHello. See http://crbug.com/130293. |
| 1402 // |
| 1403 // Only allow ERR_CONNECTION_RESET to trigger a fallback from TLS 1.1 or |
| 1404 // 1.2. We don't lose much in this fallback because the explicit IV for |
| 1405 // CBC mode in TLS 1.1 is approximated by record splitting in TLS |
| 1406 // 1.0. The fallback will be more painful for TLS 1.2 when we have GCM |
| 1407 // support. |
| 1408 // |
| 1409 // ERR_CONNECTION_RESET is a common network error, so we don't want it |
| 1410 // to trigger a version fallback in general, especially the TLS 1.0 -> |
| 1411 // SSL 3.0 fallback, which would drop TLS extensions. |
| 1412 version_max--; |
| 1413 should_fallback = true; |
| 1414 } |
| 1415 break; |
1395 case ERR_SSL_INAPPROPRIATE_FALLBACK: | 1416 case ERR_SSL_INAPPROPRIATE_FALLBACK: |
1396 // The server told us that we should not have fallen back. A buggy server | 1417 // The server told us that we should not have fallen back. A buggy server |
1397 // could trigger ERR_SSL_INAPPROPRIATE_FALLBACK with the initial | 1418 // could trigger ERR_SSL_INAPPROPRIATE_FALLBACK with the initial |
1398 // connection. |fallback_error_code_| is initialised to | 1419 // connection. |fallback_error_code_| is initialised to |
1399 // ERR_SSL_INAPPROPRIATE_FALLBACK to catch this case. | 1420 // ERR_SSL_INAPPROPRIATE_FALLBACK to catch this case. |
1400 error = fallback_error_code_; | 1421 error = fallback_error_code_; |
1401 break; | 1422 break; |
1402 } | 1423 } |
1403 | 1424 |
1404 if (should_fallback) { | 1425 if (should_fallback) { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1633 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1613 state); | 1634 state); |
1614 break; | 1635 break; |
1615 } | 1636 } |
1616 return description; | 1637 return description; |
1617 } | 1638 } |
1618 | 1639 |
1619 #undef STATE_CASE | 1640 #undef STATE_CASE |
1620 | 1641 |
1621 } // namespace net | 1642 } // namespace net |
OLD | NEW |