| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 uint16 version_after, | 99 uint16 version_after, |
| 100 NetLog::LogLevel /* log_level */) { | 100 NetLog::LogLevel /* log_level */) { |
| 101 base::DictionaryValue* dict = new base::DictionaryValue(); | 101 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 102 dict->SetString("host_and_port", GetHostAndPort(*url)); | 102 dict->SetString("host_and_port", GetHostAndPort(*url)); |
| 103 dict->SetInteger("net_error", net_error); | 103 dict->SetInteger("net_error", net_error); |
| 104 dict->SetInteger("version_before", version_before); | 104 dict->SetInteger("version_before", version_before); |
| 105 dict->SetInteger("version_after", version_after); | 105 dict->SetInteger("version_after", version_after); |
| 106 return dict; | 106 return dict; |
| 107 } | 107 } |
| 108 | 108 |
| 109 base::Value* NetLogSSLCipherFallbackCallback(const GURL* url, |
| 110 int net_error, |
| 111 NetLog::LogLevel /* log_level */) { |
| 112 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 113 dict->SetString("host_and_port", GetHostAndPort(*url)); |
| 114 dict->SetInteger("net_error", net_error); |
| 115 return dict; |
| 116 } |
| 117 |
| 109 } // namespace | 118 } // namespace |
| 110 | 119 |
| 111 //----------------------------------------------------------------------------- | 120 //----------------------------------------------------------------------------- |
| 112 | 121 |
| 113 HttpNetworkTransaction::HttpNetworkTransaction(RequestPriority priority, | 122 HttpNetworkTransaction::HttpNetworkTransaction(RequestPriority priority, |
| 114 HttpNetworkSession* session) | 123 HttpNetworkSession* session) |
| 115 : pending_auth_target_(HttpAuth::AUTH_NONE), | 124 : pending_auth_target_(HttpAuth::AUTH_NONE), |
| 116 io_callback_(base::Bind(&HttpNetworkTransaction::OnIOComplete, | 125 io_callback_(base::Bind(&HttpNetworkTransaction::OnIOComplete, |
| 117 base::Unretained(this))), | 126 base::Unretained(this))), |
| 118 session_(session), | 127 session_(session), |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 } | 1242 } |
| 1234 | 1243 |
| 1235 // TODO(rch): This does not correctly handle errors when an SSL proxy is | 1244 // TODO(rch): This does not correctly handle errors when an SSL proxy is |
| 1236 // being used, as all of the errors are handled as if they were generated | 1245 // being used, as all of the errors are handled as if they were generated |
| 1237 // by the endpoint host, request_->url, rather than considering if they were | 1246 // by the endpoint host, request_->url, rather than considering if they were |
| 1238 // generated by the SSL proxy. http://crbug.com/69329 | 1247 // generated by the SSL proxy. http://crbug.com/69329 |
| 1239 int HttpNetworkTransaction::HandleSSLHandshakeError(int error) { | 1248 int HttpNetworkTransaction::HandleSSLHandshakeError(int error) { |
| 1240 DCHECK(request_); | 1249 DCHECK(request_); |
| 1241 HandleClientAuthError(error); | 1250 HandleClientAuthError(error); |
| 1242 | 1251 |
| 1252 // Accept deprecated cipher suites, but only on a fallback. This makes UMA |
| 1253 // reflect servers require a deprecated cipher rather than merely prefer |
| 1254 // it. This, however, has no security benefit until the ciphers are actually |
| 1255 // removed. |
| 1256 if (!server_ssl_config_.enable_deprecated_cipher_suites && |
| 1257 (error == ERR_SSL_VERSION_OR_CIPHER_MISMATCH || |
| 1258 error == ERR_CONNECTION_CLOSED || error == ERR_CONNECTION_RESET)) { |
| 1259 net_log_.AddEvent( |
| 1260 NetLog::TYPE_SSL_CIPHER_FALLBACK, |
| 1261 base::Bind(&NetLogSSLCipherFallbackCallback, &request_->url, error)); |
| 1262 server_ssl_config_.enable_deprecated_cipher_suites = true; |
| 1263 ResetConnectionAndRequestForResend(); |
| 1264 return OK; |
| 1265 } |
| 1266 |
| 1243 bool should_fallback = false; | 1267 bool should_fallback = false; |
| 1244 uint16 version_max = server_ssl_config_.version_max; | 1268 uint16 version_max = server_ssl_config_.version_max; |
| 1245 | 1269 |
| 1246 switch (error) { | 1270 switch (error) { |
| 1247 case ERR_CONNECTION_CLOSED: | 1271 case ERR_CONNECTION_CLOSED: |
| 1248 case ERR_SSL_PROTOCOL_ERROR: | 1272 case ERR_SSL_PROTOCOL_ERROR: |
| 1249 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: | 1273 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: |
| 1250 if (version_max >= SSL_PROTOCOL_VERSION_TLS1 && | 1274 if (version_max >= SSL_PROTOCOL_VERSION_TLS1 && |
| 1251 version_max > server_ssl_config_.version_min) { | 1275 version_max > server_ssl_config_.version_min) { |
| 1252 // This could be a TLS-intolerant server or a server that chose a | 1276 // This could be a TLS-intolerant server or a server that chose a |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1553 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
| 1530 state); | 1554 state); |
| 1531 break; | 1555 break; |
| 1532 } | 1556 } |
| 1533 return description; | 1557 return description; |
| 1534 } | 1558 } |
| 1535 | 1559 |
| 1536 #undef STATE_CASE | 1560 #undef STATE_CASE |
| 1537 | 1561 |
| 1538 } // namespace net | 1562 } // namespace net |
| OLD | NEW |