Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: net/http/http_network_transaction.cc

Issue 14125003: Do not roll back to SSL 3.0 for Google properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup before landing(?). Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 // by the endpoint host, request_->url, rather than considering if they were 1210 // by the endpoint host, request_->url, rather than considering if they were
1210 // generated by the SSL proxy. http://crbug.com/69329 1211 // generated by the SSL proxy. http://crbug.com/69329
1211 int HttpNetworkTransaction::HandleSSLHandshakeError(int error) { 1212 int HttpNetworkTransaction::HandleSSLHandshakeError(int error) {
1212 DCHECK(request_); 1213 DCHECK(request_);
1213 if (server_ssl_config_.send_client_cert && 1214 if (server_ssl_config_.send_client_cert &&
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 uint16 version_max = server_ssl_config_.version_max;
1220 case ERR_SSL_PROTOCOL_ERROR: 1221
1221 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: 1222 if ((error == ERR_SSL_PROTOCOL_ERROR ||
wtc 2013/04/17 23:22:05 It may be clearer to retain the original switch st
thaidn_google 2013/04/18 00:05:50 Done.
1222 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && 1223 error == ERR_SSL_VERSION_OR_CIPHER_MISMATCH) &&
1223 server_ssl_config_.version_max > server_ssl_config_.version_min) { 1224 version_max >= SSL_PROTOCOL_VERSION_TLS1 &&
1224 // This could be a TLS-intolerant server or a server that chose a 1225 version_max > server_ssl_config_.version_min) {
1225 // cipher suite defined only for higher protocol versions (such as 1226 // This could be a TLS-intolerant server or a server that chose a
1226 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall 1227 // cipher suite defined only for higher protocol versions (such as
1227 // back to the next lower version and retry. 1228 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall
1228 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, 1229 // back to the next lower version and retry.
1229 // specifying TLS 1.1 in version_max will result in a TLS 1.0 1230 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1,
1230 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply 1231 // specifying TLS 1.1 in version_max will result in a TLS 1.0
1231 // repeat the TLS 1.0 handshake. To avoid this problem, the default 1232 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply
1232 // version_max should match the maximum protocol version supported 1233 // repeat the TLS 1.0 handshake. To avoid this problem, the default
1233 // by the SSLClientSocket class. 1234 // version_max should match the maximum protocol version supported
1234 uint16 version_before = server_ssl_config_.version_max; 1235 // by the SSLClientSocket class.
1235 server_ssl_config_.version_max--; 1236 version_max--;
1236 net_log_.AddEvent( 1237
1237 NetLog::TYPE_SSL_VERSION_FALLBACK, 1238 // While SSL 3.0 fallback should be eliminated because of security reasons,
1238 base::Bind(&NetLogSSLVersionFallbackCallback, 1239 // there is a high risk of breaking the servers if this is done in general.
1239 &request_->url, error, version_before, 1240 // For now SSL 3.0 fallback is disabled for Google servers first, and will
1240 server_ssl_config_.version_max)); 1241 // be expanded to other servers after enough experiences have been gained
1241 server_ssl_config_.version_fallback = true; 1242 // showing that this experiment works well with today's Internet.
1242 ResetConnectionAndRequestForResend(); 1243 if (version_max == SSL_PROTOCOL_VERSION_SSL3 &&
wtc 2013/04/17 23:22:05 BUG?: I think this should be if (version_max >
thaidn_google 2013/04/18 00:05:50 No, it isn't a bug (otherwise tests have failed).
wtc 2013/04/18 18:23:09 The unit test HTTPSRequestTest.TLSv1Fallback in ne
1243 error = OK; 1244 (server_ssl_config_.ssl3_version_fallback_enabled ||
1244 } 1245 !TransportSecurityState::IsGooglePinnedProperty(
1245 break; 1246 request_->url.host(), true /* include SNI */))) {
1246 case ERR_SSL_DECOMPRESSION_FAILURE_ALERT: 1247 net_log_.AddEvent(
1247 case ERR_SSL_BAD_RECORD_MAC_ALERT: 1248 NetLog::TYPE_SSL_VERSION_FALLBACK,
1248 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && 1249 base::Bind(&NetLogSSLVersionFallbackCallback,
1249 server_ssl_config_.version_min == SSL_PROTOCOL_VERSION_SSL3) { 1250 &request_->url, error, server_ssl_config_.version_max,
1250 // This could be a server with buggy DEFLATE support. Turn off TLS, 1251 version_max));
1251 // DEFLATE support and retry. 1252 server_ssl_config_.version_max = version_max;
1252 // TODO(wtc): turn off DEFLATE support only. Do not tie it to TLS. 1253 server_ssl_config_.version_fallback = true;
1253 uint16 version_before = server_ssl_config_.version_max; 1254 ResetConnectionAndRequestForResend();
1254 server_ssl_config_.version_max = SSL_PROTOCOL_VERSION_SSL3; 1255 error = OK;
1255 net_log_.AddEvent( 1256 }
1256 NetLog::TYPE_SSL_VERSION_FALLBACK,
1257 base::Bind(&NetLogSSLVersionFallbackCallback,
1258 &request_->url, error, version_before,
1259 server_ssl_config_.version_max));
1260 server_ssl_config_.version_fallback = true;
1261 ResetConnectionAndRequestForResend();
1262 error = OK;
1263 }
1264 break;
1265 } 1257 }
1258
1266 return error; 1259 return error;
1267 } 1260 }
1268 1261
1269 // This method determines whether it is safe to resend the request after an 1262 // This method determines whether it is safe to resend the request after an
1270 // IO error. It can only be called in response to request header or body 1263 // IO error. It can only be called in response to request header or body
1271 // write errors or response header read errors. It should not be used in 1264 // write errors or response header read errors. It should not be used in
1272 // other cases, such as a Connect error. 1265 // other cases, such as a Connect error.
1273 int HttpNetworkTransaction::HandleIOError(int error) { 1266 int HttpNetworkTransaction::HandleIOError(int error) {
1274 // SSL errors may happen at any time during the stream and indicate issues 1267 // SSL errors may happen at any time during the stream and indicate issues
1275 // with the underlying connection. Because the peer may request 1268 // with the underlying connection. Because the peer may request
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1454 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1462 state); 1455 state);
1463 break; 1456 break;
1464 } 1457 }
1465 return description; 1458 return description;
1466 } 1459 }
1467 1460
1468 #undef STATE_CASE 1461 #undef STATE_CASE
1469 1462
1470 } // namespace net 1463 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698