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

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 sending for reviews. 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 166
166 int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info, 167 int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info,
167 const CompletionCallback& callback, 168 const CompletionCallback& callback,
168 const BoundNetLog& net_log) { 169 const BoundNetLog& net_log) {
169 SIMPLE_STATS_COUNTER("HttpNetworkTransaction.Count"); 170 SIMPLE_STATS_COUNTER("HttpNetworkTransaction.Count");
170 171
171 net_log_ = net_log; 172 net_log_ = net_log;
172 request_ = request_info; 173 request_ = request_info;
173 start_time_ = base::Time::Now(); 174 start_time_ = base::Time::Now();
174 175
175 if (request_->load_flags & LOAD_DISABLE_CERT_REVOCATION_CHECKING) { 176 if (request_->load_flags & LOAD_DISABLE_CERT_REVOCATION_CHECKING) {
wtc 2013/04/17 19:49:50 IMPORTANT: the name "ssl_version_min_preloaded_dis
thaidn_google 2013/04/17 22:16:07 This was my original approach. Chris pointed out t
176 server_ssl_config_.rev_checking_enabled = false; 177 server_ssl_config_.rev_checking_enabled = false;
177 proxy_ssl_config_.rev_checking_enabled = false; 178 proxy_ssl_config_.rev_checking_enabled = false;
178 } 179 }
179 180
180 next_state_ = STATE_CREATE_STREAM; 181 next_state_ = STATE_CREATE_STREAM;
181 int rv = DoLoop(OK); 182 int rv = DoLoop(OK);
182 if (rv == ERR_IO_PENDING) 183 if (rv == ERR_IO_PENDING)
183 callback_ = callback; 184 callback_ = callback;
184 return rv; 185 return rv;
185 } 186 }
(...skipping 1023 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
1220 uint16 version_max = server_ssl_config_.version_max;
1221
1219 switch (error) { 1222 switch (error) {
1220 case ERR_SSL_PROTOCOL_ERROR: 1223 case ERR_SSL_PROTOCOL_ERROR:
1221 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: 1224 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH:
1222 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && 1225 if (version_max >= SSL_PROTOCOL_VERSION_TLS1 &&
1223 server_ssl_config_.version_max > server_ssl_config_.version_min) { 1226 version_max > server_ssl_config_.version_min) {
1224 // This could be a TLS-intolerant server or a server that chose a 1227 // This could be a TLS-intolerant server or a server that chose a
1225 // cipher suite defined only for higher protocol versions (such as 1228 // cipher suite defined only for higher protocol versions (such as
1226 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall 1229 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall
1227 // back to the next lower version and retry. 1230 // back to the next lower version and retry.
1228 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, 1231 // 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 1232 // 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 1233 // 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 1234 // repeat the TLS 1.0 handshake. To avoid this problem, the default
1232 // version_max should match the maximum protocol version supported 1235 // version_max should match the maximum protocol version supported
1233 // by the SSLClientSocket class. 1236 // by the SSLClientSocket class.
1234 uint16 version_before = server_ssl_config_.version_max; 1237 version_max--;
1235 server_ssl_config_.version_max--;
1236 net_log_.AddEvent(
1237 NetLog::TYPE_SSL_VERSION_FALLBACK,
1238 base::Bind(&NetLogSSLVersionFallbackCallback,
1239 &request_->url, error, version_before,
1240 server_ssl_config_.version_max));
1241 server_ssl_config_.version_fallback = true;
1242 ResetConnectionAndRequestForResend();
1243 error = OK;
1244 } 1238 }
1245 break; 1239 break;
1246 case ERR_SSL_DECOMPRESSION_FAILURE_ALERT: 1240 case ERR_SSL_DECOMPRESSION_FAILURE_ALERT:
1247 case ERR_SSL_BAD_RECORD_MAC_ALERT: 1241 case ERR_SSL_BAD_RECORD_MAC_ALERT:
1248 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && 1242 if (version_max >= SSL_PROTOCOL_VERSION_TLS1 &&
1249 server_ssl_config_.version_min == SSL_PROTOCOL_VERSION_SSL3) { 1243 version_max == SSL_PROTOCOL_VERSION_SSL3) {
wtc 2013/04/17 19:49:50 BUG?: The original code uses server_ssl_config_.ve
1250 // This could be a server with buggy DEFLATE support. Turn off TLS, 1244 // This could be a server with buggy DEFLATE support. Turn off TLS,
1251 // DEFLATE support and retry. 1245 // DEFLATE support and retry.
1252 // TODO(wtc): turn off DEFLATE support only. Do not tie it to TLS. 1246 // TODO(wtc): turn off DEFLATE support only. Do not tie it to TLS.
1253 uint16 version_before = server_ssl_config_.version_max; 1247 version_max = SSL_PROTOCOL_VERSION_SSL3;
1254 server_ssl_config_.version_max = SSL_PROTOCOL_VERSION_SSL3;
1255 net_log_.AddEvent(
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 } 1248 }
1264 break; 1249 break;
1265 } 1250 }
1251
1252 if (version_max != server_ssl_config_.version_max &&
1253 // Do not fallback to SSL 3.0 on Google properties.
wtc 2013/04/17 19:49:50 I suggest moving this comment before the if statem
thaidn_google 2013/04/17 22:16:07 Done.
1254 !(version_max <= SSL_PROTOCOL_VERSION_SSL3 &&
1255 !server_ssl_config_.ssl_version_min_preloaded_disabled &&
wtc 2013/04/17 19:49:50 I think "hsts" should be part of this member's nam
thaidn_google 2013/04/17 22:16:07 I rename it to ssl3_version_fallback_enabled. I c
1256 TransportSecurityState::IsGooglePinnedProperty(
1257 request_->url.host(), true /* include SNI */))) {
1258 net_log_.AddEvent(
1259 NetLog::TYPE_SSL_VERSION_FALLBACK,
1260 base::Bind(&NetLogSSLVersionFallbackCallback,
1261 &request_->url, error, server_ssl_config_.version_max,
1262 version_max));
1263 server_ssl_config_.version_max = version_max;
1264 server_ssl_config_.version_fallback = true;
1265 ResetConnectionAndRequestForResend();
1266 error = OK;
1267 }
1268
1266 return error; 1269 return error;
1267 } 1270 }
1268 1271
1269 // This method determines whether it is safe to resend the request after an 1272 // 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 1273 // 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 1274 // write errors or response header read errors. It should not be used in
1272 // other cases, such as a Connect error. 1275 // other cases, such as a Connect error.
1273 int HttpNetworkTransaction::HandleIOError(int error) { 1276 int HttpNetworkTransaction::HandleIOError(int error) {
1274 // SSL errors may happen at any time during the stream and indicate issues 1277 // SSL errors may happen at any time during the stream and indicate issues
1275 // with the underlying connection. Because the peer may request 1278 // 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, 1464 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1462 state); 1465 state);
1463 break; 1466 break;
1464 } 1467 }
1465 return description; 1468 return description;
1466 } 1469 }
1467 1470
1468 #undef STATE_CASE 1471 #undef STATE_CASE
1469 1472
1470 } // namespace net 1473 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698