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 #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 29 matching lines...) Expand all Loading... | |
| 40 #include "net/http/http_proxy_client_socket_pool.h" | 40 #include "net/http/http_proxy_client_socket_pool.h" |
| 41 #include "net/http/http_request_headers.h" | 41 #include "net/http/http_request_headers.h" |
| 42 #include "net/http/http_request_info.h" | 42 #include "net/http/http_request_info.h" |
| 43 #include "net/http/http_response_headers.h" | 43 #include "net/http/http_response_headers.h" |
| 44 #include "net/http/http_response_info.h" | 44 #include "net/http/http_response_info.h" |
| 45 #include "net/http/http_server_properties.h" | 45 #include "net/http/http_server_properties.h" |
| 46 #include "net/http/http_status_code.h" | 46 #include "net/http/http_status_code.h" |
| 47 #include "net/http/http_stream_base.h" | 47 #include "net/http/http_stream_base.h" |
| 48 #include "net/http/http_stream_factory.h" | 48 #include "net/http/http_stream_factory.h" |
| 49 #include "net/http/http_util.h" | 49 #include "net/http/http_util.h" |
| 50 #include "net/http/transport_security_state.h" | |
| 50 #include "net/http/url_security_manager.h" | 51 #include "net/http/url_security_manager.h" |
| 51 #include "net/socket/client_socket_factory.h" | 52 #include "net/socket/client_socket_factory.h" |
| 52 #include "net/socket/socks_client_socket_pool.h" | 53 #include "net/socket/socks_client_socket_pool.h" |
| 53 #include "net/socket/ssl_client_socket.h" | 54 #include "net/socket/ssl_client_socket.h" |
| 54 #include "net/socket/ssl_client_socket_pool.h" | 55 #include "net/socket/ssl_client_socket_pool.h" |
| 55 #include "net/socket/transport_client_socket_pool.h" | 56 #include "net/socket/transport_client_socket_pool.h" |
| 56 #include "net/spdy/spdy_http_stream.h" | 57 #include "net/spdy/spdy_http_stream.h" |
| 57 #include "net/spdy/spdy_session.h" | 58 #include "net/spdy/spdy_session.h" |
| 58 #include "net/spdy/spdy_session_pool.h" | 59 #include "net/spdy/spdy_session_pool.h" |
| 59 #include "net/ssl/ssl_cert_request_info.h" | 60 #include "net/ssl/ssl_cert_request_info.h" |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1214 (error == ERR_SSL_PROTOCOL_ERROR || IsClientCertificateError(error))) { | 1215 (error == ERR_SSL_PROTOCOL_ERROR || IsClientCertificateError(error))) { |
| 1215 session_->ssl_client_auth_cache()->Remove( | 1216 session_->ssl_client_auth_cache()->Remove( |
| 1216 GetHostAndPort(request_->url)); | 1217 GetHostAndPort(request_->url)); |
| 1217 } | 1218 } |
| 1218 | 1219 |
| 1219 switch (error) { | 1220 switch (error) { |
| 1220 case ERR_SSL_PROTOCOL_ERROR: | 1221 case ERR_SSL_PROTOCOL_ERROR: |
| 1221 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: | 1222 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: |
| 1222 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && | 1223 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && |
| 1223 server_ssl_config_.version_max > server_ssl_config_.version_min) { | 1224 server_ssl_config_.version_max > server_ssl_config_.version_min) { |
| 1225 | |
| 1226 if (server_ssl_config_.version_max == SSL_PROTOCOL_VERSION_TLS1 && | |
|
agl
2013/04/16 15:19:24
Can't think chunk live before the switch() and thu
Ryan Sleevi
2013/04/16 19:55:26
Yeah, I think this switch can/should be re-organiz
thaidn_google
2013/04/17 00:46:17
Done.
| |
| 1227 !server_ssl_config_.ssl_version_min_preloaded_disabled && | |
| 1228 TransportSecurityState::IsGooglePinnedProperty( | |
| 1229 request_->url.host(), true /* include SNI */ )) { | |
| 1230 // Chrome shouldn't fallback to SSL3 for Google's properties. | |
| 1231 break; | |
| 1232 } | |
| 1233 | |
| 1224 // This could be a TLS-intolerant server or a server that chose a | 1234 // This could be a TLS-intolerant server or a server that chose a |
| 1225 // cipher suite defined only for higher protocol versions (such as | 1235 // cipher suite defined only for higher protocol versions (such as |
| 1226 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall | 1236 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall |
| 1227 // back to the next lower version and retry. | 1237 // back to the next lower version and retry. |
| 1228 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, | 1238 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, |
| 1229 // specifying TLS 1.1 in version_max will result in a TLS 1.0 | 1239 // specifying TLS 1.1 in version_max will result in a TLS 1.0 |
| 1230 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply | 1240 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply |
| 1231 // repeat the TLS 1.0 handshake. To avoid this problem, the default | 1241 // repeat the TLS 1.0 handshake. To avoid this problem, the default |
| 1232 // version_max should match the maximum protocol version supported | 1242 // version_max should match the maximum protocol version supported |
| 1233 // by the SSLClientSocket class. | 1243 // by the SSLClientSocket class. |
| 1234 uint16 version_before = server_ssl_config_.version_max; | 1244 uint16 version_before = server_ssl_config_.version_max; |
| 1235 server_ssl_config_.version_max--; | 1245 server_ssl_config_.version_max--; |
| 1236 net_log_.AddEvent( | 1246 net_log_.AddEvent( |
| 1237 NetLog::TYPE_SSL_VERSION_FALLBACK, | 1247 NetLog::TYPE_SSL_VERSION_FALLBACK, |
| 1238 base::Bind(&NetLogSSLVersionFallbackCallback, | 1248 base::Bind(&NetLogSSLVersionFallbackCallback, |
| 1239 &request_->url, error, version_before, | 1249 &request_->url, error, version_before, |
| 1240 server_ssl_config_.version_max)); | 1250 server_ssl_config_.version_max)); |
| 1241 server_ssl_config_.version_fallback = true; | 1251 server_ssl_config_.version_fallback = true; |
| 1242 ResetConnectionAndRequestForResend(); | 1252 ResetConnectionAndRequestForResend(); |
| 1243 error = OK; | 1253 error = OK; |
| 1244 } | 1254 } |
| 1245 break; | 1255 break; |
| 1246 case ERR_SSL_DECOMPRESSION_FAILURE_ALERT: | 1256 case ERR_SSL_DECOMPRESSION_FAILURE_ALERT: |
| 1247 case ERR_SSL_BAD_RECORD_MAC_ALERT: | 1257 case ERR_SSL_BAD_RECORD_MAC_ALERT: |
| 1248 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && | 1258 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && |
| 1249 server_ssl_config_.version_min == SSL_PROTOCOL_VERSION_SSL3) { | 1259 server_ssl_config_.version_min == SSL_PROTOCOL_VERSION_SSL3) { |
| 1260 | |
| 1261 if (!server_ssl_config_.ssl_version_min_preloaded_disabled && | |
| 1262 TransportSecurityState::IsGooglePinnedProperty( | |
| 1263 request_->url.host(), true /* include SNI */ )) { | |
| 1264 // Chrome shouldn't fallback to SSL3 for Google's properties. | |
| 1265 break; | |
| 1266 } | |
| 1267 | |
| 1250 // This could be a server with buggy DEFLATE support. Turn off TLS, | 1268 // This could be a server with buggy DEFLATE support. Turn off TLS, |
| 1251 // DEFLATE support and retry. | 1269 // DEFLATE support and retry. |
| 1252 // TODO(wtc): turn off DEFLATE support only. Do not tie it to TLS. | 1270 // TODO(wtc): turn off DEFLATE support only. Do not tie it to TLS. |
| 1253 uint16 version_before = server_ssl_config_.version_max; | 1271 uint16 version_before = server_ssl_config_.version_max; |
| 1254 server_ssl_config_.version_max = SSL_PROTOCOL_VERSION_SSL3; | 1272 server_ssl_config_.version_max = SSL_PROTOCOL_VERSION_SSL3; |
| 1255 net_log_.AddEvent( | 1273 net_log_.AddEvent( |
| 1256 NetLog::TYPE_SSL_VERSION_FALLBACK, | 1274 NetLog::TYPE_SSL_VERSION_FALLBACK, |
| 1257 base::Bind(&NetLogSSLVersionFallbackCallback, | 1275 base::Bind(&NetLogSSLVersionFallbackCallback, |
| 1258 &request_->url, error, version_before, | 1276 &request_->url, error, version_before, |
| 1259 server_ssl_config_.version_max)); | 1277 server_ssl_config_.version_max)); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1461 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1479 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
| 1462 state); | 1480 state); |
| 1463 break; | 1481 break; |
| 1464 } | 1482 } |
| 1465 return description; | 1483 return description; |
| 1466 } | 1484 } |
| 1467 | 1485 |
| 1468 #undef STATE_CASE | 1486 #undef STATE_CASE |
| 1469 | 1487 |
| 1470 } // namespace net | 1488 } // namespace net |
| OLD | NEW |