| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 session->http_stream_factory()->ProcessAlternateProtocol( | 88 session->http_stream_factory()->ProcessAlternateProtocol( |
| 89 session->http_server_properties(), | 89 session->http_server_properties(), |
| 90 alternate_protocol_values, | 90 alternate_protocol_values, |
| 91 http_host_port_pair, | 91 http_host_port_pair, |
| 92 *session); | 92 *session); |
| 93 } | 93 } |
| 94 | 94 |
| 95 base::Value* NetLogSSLVersionFallbackCallback( | 95 scoped_ptr<base::Value> NetLogSSLVersionFallbackCallback( |
| 96 const GURL* url, | 96 const GURL* url, |
| 97 int net_error, | 97 int net_error, |
| 98 uint16 version_before, | 98 uint16 version_before, |
| 99 uint16 version_after, | 99 uint16 version_after, |
| 100 NetLogCaptureMode /* capture_mode */) { | 100 NetLogCaptureMode /* capture_mode */) { |
| 101 base::DictionaryValue* dict = new base::DictionaryValue(); | 101 scoped_ptr<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.Pass(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 base::Value* NetLogSSLCipherFallbackCallback( | 109 scoped_ptr<base::Value> NetLogSSLCipherFallbackCallback( |
| 110 const GURL* url, | 110 const GURL* url, |
| 111 int net_error, | 111 int net_error, |
| 112 NetLogCaptureMode /* capture_mode */) { | 112 NetLogCaptureMode /* capture_mode */) { |
| 113 base::DictionaryValue* dict = new base::DictionaryValue(); | 113 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 114 dict->SetString("host_and_port", GetHostAndPort(*url)); | 114 dict->SetString("host_and_port", GetHostAndPort(*url)); |
| 115 dict->SetInteger("net_error", net_error); | 115 dict->SetInteger("net_error", net_error); |
| 116 return dict; | 116 return dict.Pass(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace | 119 } // namespace |
| 120 | 120 |
| 121 //----------------------------------------------------------------------------- | 121 //----------------------------------------------------------------------------- |
| 122 | 122 |
| 123 HttpNetworkTransaction::HttpNetworkTransaction(RequestPriority priority, | 123 HttpNetworkTransaction::HttpNetworkTransaction(RequestPriority priority, |
| 124 HttpNetworkSession* session) | 124 HttpNetworkSession* session) |
| 125 : pending_auth_target_(HttpAuth::AUTH_NONE), | 125 : pending_auth_target_(HttpAuth::AUTH_NONE), |
| 126 io_callback_(base::Bind(&HttpNetworkTransaction::OnIOComplete, | 126 io_callback_(base::Bind(&HttpNetworkTransaction::OnIOComplete, |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 | 1267 |
| 1268 // Accept deprecated cipher suites, but only on a fallback. This makes UMA | 1268 // Accept deprecated cipher suites, but only on a fallback. This makes UMA |
| 1269 // reflect servers require a deprecated cipher rather than merely prefer | 1269 // reflect servers require a deprecated cipher rather than merely prefer |
| 1270 // it. This, however, has no security benefit until the ciphers are actually | 1270 // it. This, however, has no security benefit until the ciphers are actually |
| 1271 // removed. | 1271 // removed. |
| 1272 if (!server_ssl_config_.enable_deprecated_cipher_suites && | 1272 if (!server_ssl_config_.enable_deprecated_cipher_suites && |
| 1273 (error == ERR_SSL_VERSION_OR_CIPHER_MISMATCH || | 1273 (error == ERR_SSL_VERSION_OR_CIPHER_MISMATCH || |
| 1274 error == ERR_CONNECTION_CLOSED || error == ERR_CONNECTION_RESET)) { | 1274 error == ERR_CONNECTION_CLOSED || error == ERR_CONNECTION_RESET)) { |
| 1275 net_log_.AddEvent( | 1275 net_log_.AddEvent( |
| 1276 NetLog::TYPE_SSL_CIPHER_FALLBACK, | 1276 NetLog::TYPE_SSL_CIPHER_FALLBACK, |
| 1277 base::Bind(&NetLogSSLCipherFallbackCallback, &request_->url, error)); | 1277 base::Bind(NetLogSSLCipherFallbackCallback, &request_->url, error)); |
| 1278 server_ssl_config_.enable_deprecated_cipher_suites = true; | 1278 server_ssl_config_.enable_deprecated_cipher_suites = true; |
| 1279 ResetConnectionAndRequestForResend(); | 1279 ResetConnectionAndRequestForResend(); |
| 1280 return OK; | 1280 return OK; |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 bool should_fallback = false; | 1283 bool should_fallback = false; |
| 1284 uint16 version_max = server_ssl_config_.version_max; | 1284 uint16 version_max = server_ssl_config_.version_max; |
| 1285 | 1285 |
| 1286 switch (error) { | 1286 switch (error) { |
| 1287 case ERR_CONNECTION_CLOSED: | 1287 case ERR_CONNECTION_CLOSED: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 // could trigger ERR_SSL_INAPPROPRIATE_FALLBACK with the initial | 1344 // could trigger ERR_SSL_INAPPROPRIATE_FALLBACK with the initial |
| 1345 // connection. |fallback_error_code_| is initialised to | 1345 // connection. |fallback_error_code_| is initialised to |
| 1346 // ERR_SSL_INAPPROPRIATE_FALLBACK to catch this case. | 1346 // ERR_SSL_INAPPROPRIATE_FALLBACK to catch this case. |
| 1347 error = fallback_error_code_; | 1347 error = fallback_error_code_; |
| 1348 break; | 1348 break; |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 if (should_fallback) { | 1351 if (should_fallback) { |
| 1352 net_log_.AddEvent( | 1352 net_log_.AddEvent( |
| 1353 NetLog::TYPE_SSL_VERSION_FALLBACK, | 1353 NetLog::TYPE_SSL_VERSION_FALLBACK, |
| 1354 base::Bind(&NetLogSSLVersionFallbackCallback, | 1354 base::Bind(NetLogSSLVersionFallbackCallback, &request_->url, error, |
| 1355 &request_->url, error, server_ssl_config_.version_max, | 1355 server_ssl_config_.version_max, version_max)); |
| 1356 version_max)); | |
| 1357 fallback_error_code_ = error; | 1356 fallback_error_code_ = error; |
| 1358 server_ssl_config_.version_max = version_max; | 1357 server_ssl_config_.version_max = version_max; |
| 1359 server_ssl_config_.version_fallback = true; | 1358 server_ssl_config_.version_fallback = true; |
| 1360 ResetConnectionAndRequestForResend(); | 1359 ResetConnectionAndRequestForResend(); |
| 1361 error = OK; | 1360 error = OK; |
| 1362 } | 1361 } |
| 1363 | 1362 |
| 1364 return error; | 1363 return error; |
| 1365 } | 1364 } |
| 1366 | 1365 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 DCHECK(stream_request_); | 1621 DCHECK(stream_request_); |
| 1623 | 1622 |
| 1624 // Since the transaction can restart with auth credentials, it may create a | 1623 // Since the transaction can restart with auth credentials, it may create a |
| 1625 // stream more than once. Accumulate all of the connection attempts across | 1624 // stream more than once. Accumulate all of the connection attempts across |
| 1626 // those streams by appending them to the vector: | 1625 // those streams by appending them to the vector: |
| 1627 for (const auto& attempt : stream_request_->connection_attempts()) | 1626 for (const auto& attempt : stream_request_->connection_attempts()) |
| 1628 connection_attempts_.push_back(attempt); | 1627 connection_attempts_.push_back(attempt); |
| 1629 } | 1628 } |
| 1630 | 1629 |
| 1631 } // namespace net | 1630 } // namespace net |
| OLD | NEW |