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

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: Change switch to --enable-unrestricted-ssl3-fallback; Remove obsolete TLS decompression test cases. 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 if (ShouldApplyProxyAuth() && HaveAuth(HttpAuth::AUTH_PROXY)) 770 if (ShouldApplyProxyAuth() && HaveAuth(HttpAuth::AUTH_PROXY))
770 auth_controllers_[HttpAuth::AUTH_PROXY]->AddAuthorizationHeader( 771 auth_controllers_[HttpAuth::AUTH_PROXY]->AddAuthorizationHeader(
771 &request_headers_); 772 &request_headers_);
772 if (ShouldApplyServerAuth() && HaveAuth(HttpAuth::AUTH_SERVER)) 773 if (ShouldApplyServerAuth() && HaveAuth(HttpAuth::AUTH_SERVER))
773 auth_controllers_[HttpAuth::AUTH_SERVER]->AddAuthorizationHeader( 774 auth_controllers_[HttpAuth::AUTH_SERVER]->AddAuthorizationHeader(
774 &request_headers_); 775 &request_headers_);
775 776
776 request_headers_.MergeFrom(request_->extra_headers); 777 request_headers_.MergeFrom(request_->extra_headers);
777 response_.did_use_http_auth = 778 response_.did_use_http_auth =
778 request_headers_.HasHeader(HttpRequestHeaders::kAuthorization) || 779 request_headers_.HasHeader(HttpRequestHeaders::kAuthorization) ||
779 request_headers_.HasHeader(HttpRequestHeaders::kProxyAuthorization); 780 request_headers_.HasHeader(HttpRequestHeaders::kProxyAuthorization);
thaidn_google 2013/04/19 01:42:55 Not me.
780 } 781 }
781 782
782 int HttpNetworkTransaction::DoInitRequestBody() { 783 int HttpNetworkTransaction::DoInitRequestBody() {
783 next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE; 784 next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE;
784 int rv = OK; 785 int rv = OK;
785 if (request_->upload_data_stream) 786 if (request_->upload_data_stream)
786 rv = request_->upload_data_stream->Init(io_callback_); 787 rv = request_->upload_data_stream->Init(io_callback_);
787 return rv; 788 return rv;
788 } 789 }
789 790
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 // by the endpoint host, request_->url, rather than considering if they were 1177 // by the endpoint host, request_->url, rather than considering if they were
1177 // generated by the SSL proxy. http://crbug.com/69329 1178 // generated by the SSL proxy. http://crbug.com/69329
1178 int HttpNetworkTransaction::HandleSSLHandshakeError(int error) { 1179 int HttpNetworkTransaction::HandleSSLHandshakeError(int error) {
1179 DCHECK(request_); 1180 DCHECK(request_);
1180 if (server_ssl_config_.send_client_cert && 1181 if (server_ssl_config_.send_client_cert &&
1181 (error == ERR_SSL_PROTOCOL_ERROR || IsClientCertificateError(error))) { 1182 (error == ERR_SSL_PROTOCOL_ERROR || IsClientCertificateError(error))) {
1182 session_->ssl_client_auth_cache()->Remove( 1183 session_->ssl_client_auth_cache()->Remove(
1183 GetHostAndPort(request_->url)); 1184 GetHostAndPort(request_->url));
1184 } 1185 }
1185 1186
1187 uint16 version_max = server_ssl_config_.version_max;
1188
1186 switch (error) { 1189 switch (error) {
1187 case ERR_SSL_PROTOCOL_ERROR: 1190 case ERR_SSL_PROTOCOL_ERROR:
1188 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: 1191 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH:
1189 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && 1192 if (version_max >= SSL_PROTOCOL_VERSION_TLS1 &&
1190 server_ssl_config_.version_max > server_ssl_config_.version_min) { 1193 version_max > server_ssl_config_.version_min) {
1191 // This could be a TLS-intolerant server or a server that chose a 1194 // This could be a TLS-intolerant server or a server that chose a
1192 // cipher suite defined only for higher protocol versions (such as 1195 // cipher suite defined only for higher protocol versions (such as
1193 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall 1196 // an SSL 3.0 server that chose a TLS-only cipher suite). Fall
1194 // back to the next lower version and retry. 1197 // back to the next lower version and retry.
1195 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1, 1198 // NOTE: if the SSLClientSocket class doesn't support TLS 1.1,
1196 // specifying TLS 1.1 in version_max will result in a TLS 1.0 1199 // specifying TLS 1.1 in version_max will result in a TLS 1.0
1197 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply 1200 // handshake, so falling back from TLS 1.1 to TLS 1.0 will simply
1198 // repeat the TLS 1.0 handshake. To avoid this problem, the default 1201 // repeat the TLS 1.0 handshake. To avoid this problem, the default
1199 // version_max should match the maximum protocol version supported 1202 // version_max should match the maximum protocol version supported
1200 // by the SSLClientSocket class. 1203 // by the SSLClientSocket class.
1201 uint16 version_before = server_ssl_config_.version_max; 1204 version_max--;
1202 server_ssl_config_.version_max--; 1205
1203 net_log_.AddEvent( 1206 // Fallback to the lower SSL version.
1204 NetLog::TYPE_SSL_VERSION_FALLBACK, 1207 // While SSL 3.0 fallback should be eliminated because of security
1205 base::Bind(&NetLogSSLVersionFallbackCallback, 1208 // reasons, there is a high risk of breaking the servers if this is
1206 &request_->url, error, version_before, 1209 // done in general.
1207 server_ssl_config_.version_max)); 1210 // For now SSL 3.0 fallback is disabled for Google servers first,
1208 server_ssl_config_.version_fallback = true; 1211 // and will be expanded to other servers after enough experiences
1209 ResetConnectionAndRequestForResend(); 1212 // have been gained showing that this experiment works well with
1210 error = OK; 1213 // today's Internet.
1211 } 1214 if (version_max > SSL_PROTOCOL_VERSION_SSL3 ||
1212 break; 1215 (server_ssl_config_.unrestricted_ssl3_fallback_enabled ||
1213 case ERR_SSL_DECOMPRESSION_FAILURE_ALERT: 1216 !TransportSecurityState::IsGooglePinnedProperty(
1214 case ERR_SSL_BAD_RECORD_MAC_ALERT: 1217 request_->url.host(), true /* include SNI */))) {
1215 if (server_ssl_config_.version_max >= SSL_PROTOCOL_VERSION_TLS1 && 1218 net_log_.AddEvent(
1216 server_ssl_config_.version_min == SSL_PROTOCOL_VERSION_SSL3) { 1219 NetLog::TYPE_SSL_VERSION_FALLBACK,
1217 // This could be a server with buggy DEFLATE support. Turn off TLS, 1220 base::Bind(&NetLogSSLVersionFallbackCallback,
1218 // DEFLATE support and retry. 1221 &request_->url, error, server_ssl_config_.version_max,
1219 // TODO(wtc): turn off DEFLATE support only. Do not tie it to TLS. 1222 version_max));
1220 uint16 version_before = server_ssl_config_.version_max; 1223 server_ssl_config_.version_max = version_max;
1221 server_ssl_config_.version_max = SSL_PROTOCOL_VERSION_SSL3; 1224 server_ssl_config_.version_fallback = true;
1222 net_log_.AddEvent( 1225 ResetConnectionAndRequestForResend();
1223 NetLog::TYPE_SSL_VERSION_FALLBACK, 1226 error = OK;
1224 base::Bind(&NetLogSSLVersionFallbackCallback, 1227 }
1225 &request_->url, error, version_before,
1226 server_ssl_config_.version_max));
1227 server_ssl_config_.version_fallback = true;
1228 ResetConnectionAndRequestForResend();
1229 error = OK;
1230 } 1228 }
1231 break; 1229 break;
1232 } 1230 }
1231
1233 return error; 1232 return error;
1234 } 1233 }
1235 1234
1236 // This method determines whether it is safe to resend the request after an 1235 // This method determines whether it is safe to resend the request after an
1237 // IO error. It can only be called in response to request header or body 1236 // IO error. It can only be called in response to request header or body
1238 // write errors or response header read errors. It should not be used in 1237 // write errors or response header read errors. It should not be used in
1239 // other cases, such as a Connect error. 1238 // other cases, such as a Connect error.
1240 int HttpNetworkTransaction::HandleIOError(int error) { 1239 int HttpNetworkTransaction::HandleIOError(int error) {
1241 // SSL errors may happen at any time during the stream and indicate issues 1240 // SSL errors may happen at any time during the stream and indicate issues
1242 // with the underlying connection. Because the peer may request 1241 // with the underlying connection. Because the peer may request
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1427 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1429 state); 1428 state);
1430 break; 1429 break;
1431 } 1430 }
1432 return description; 1431 return description;
1433 } 1432 }
1434 1433
1435 #undef STATE_CASE 1434 #undef STATE_CASE
1436 1435
1437 } // namespace net 1436 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698