| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/metrics/stats_counters.h" | 14 #include "base/metrics/stats_counters.h" |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/stringprintf.h" | 19 #include "base/stringprintf.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 #include "net/base/auth.h" | 22 #include "net/base/auth.h" |
| 23 #include "net/base/host_port_pair.h" |
| 23 #include "net/base/io_buffer.h" | 24 #include "net/base/io_buffer.h" |
| 24 #include "net/base/load_flags.h" | 25 #include "net/base/load_flags.h" |
| 25 #include "net/base/net_errors.h" | 26 #include "net/base/net_errors.h" |
| 26 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 27 #include "net/base/network_delegate.h" | 28 #include "net/base/network_delegate.h" |
| 28 #include "net/base/ssl_cert_request_info.h" | 29 #include "net/base/ssl_cert_request_info.h" |
| 29 #include "net/base/ssl_connection_status_flags.h" | 30 #include "net/base/ssl_connection_status_flags.h" |
| 30 #include "net/base/upload_data_stream.h" | 31 #include "net/base/upload_data_stream.h" |
| 31 #include "net/http/http_auth.h" | 32 #include "net/http/http_auth.h" |
| 32 #include "net/http/http_auth_handler.h" | 33 #include "net/http/http_auth_handler.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 365 |
| 365 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, | 366 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, |
| 366 const ProxyInfo& used_proxy_info, | 367 const ProxyInfo& used_proxy_info, |
| 367 HttpStream* stream) { | 368 HttpStream* stream) { |
| 368 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); | 369 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
| 369 DCHECK(stream_request_.get()); | 370 DCHECK(stream_request_.get()); |
| 370 | 371 |
| 371 stream_.reset(stream); | 372 stream_.reset(stream); |
| 372 ssl_config_ = used_ssl_config; | 373 ssl_config_ = used_ssl_config; |
| 373 proxy_info_ = used_proxy_info; | 374 proxy_info_ = used_proxy_info; |
| 374 response_.was_alternate_protocol_available = | |
| 375 stream_request_->was_alternate_protocol_available(); | |
| 376 response_.was_npn_negotiated = stream_request_->was_npn_negotiated(); | 375 response_.was_npn_negotiated = stream_request_->was_npn_negotiated(); |
| 377 response_.was_fetched_via_spdy = stream_request_->using_spdy(); | 376 response_.was_fetched_via_spdy = stream_request_->using_spdy(); |
| 378 response_.was_fetched_via_proxy = !proxy_info_.is_direct(); | 377 response_.was_fetched_via_proxy = !proxy_info_.is_direct(); |
| 379 | 378 |
| 380 OnIOComplete(OK); | 379 OnIOComplete(OK); |
| 381 } | 380 } |
| 382 | 381 |
| 383 void HttpNetworkTransaction::OnStreamFailed(int result, | 382 void HttpNetworkTransaction::OnStreamFailed(int result, |
| 384 const SSLConfig& used_ssl_config) { | 383 const SSLConfig& used_ssl_config) { |
| 385 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); | 384 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 switch (error) { | 1062 switch (error) { |
| 1064 case ERR_SSL_PROTOCOL_ERROR: | 1063 case ERR_SSL_PROTOCOL_ERROR: |
| 1065 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: | 1064 case ERR_SSL_VERSION_OR_CIPHER_MISMATCH: |
| 1066 case ERR_SSL_DECOMPRESSION_FAILURE_ALERT: | 1065 case ERR_SSL_DECOMPRESSION_FAILURE_ALERT: |
| 1067 case ERR_SSL_BAD_RECORD_MAC_ALERT: | 1066 case ERR_SSL_BAD_RECORD_MAC_ALERT: |
| 1068 if (ssl_config_.tls1_enabled && | 1067 if (ssl_config_.tls1_enabled && |
| 1069 !SSLConfigService::IsKnownStrictTLSServer(request_->url.host())) { | 1068 !SSLConfigService::IsKnownStrictTLSServer(request_->url.host())) { |
| 1070 // This could be a TLS-intolerant server, an SSL 3.0 server that | 1069 // This could be a TLS-intolerant server, an SSL 3.0 server that |
| 1071 // chose a TLS-only cipher suite or a server with buggy DEFLATE | 1070 // chose a TLS-only cipher suite or a server with buggy DEFLATE |
| 1072 // support. Turn off TLS 1.0, DEFLATE support and retry. | 1071 // support. Turn off TLS 1.0, DEFLATE support and retry. |
| 1073 session_->http_stream_factory()->AddTLSIntolerantServer(request_->url); | 1072 session_->http_stream_factory()->AddTLSIntolerantServer( |
| 1073 HostPortPair::FromURL(request_->url)); |
| 1074 ResetConnectionAndRequestForResend(); | 1074 ResetConnectionAndRequestForResend(); |
| 1075 error = OK; | 1075 error = OK; |
| 1076 } | 1076 } |
| 1077 break; | 1077 break; |
| 1078 case ERR_SSL_SNAP_START_NPN_MISPREDICTION: | 1078 case ERR_SSL_SNAP_START_NPN_MISPREDICTION: |
| 1079 // This means that we tried to Snap Start a connection, but we | 1079 // This means that we tried to Snap Start a connection, but we |
| 1080 // mispredicted the NPN result. This isn't a problem from the point of | 1080 // mispredicted the NPN result. This isn't a problem from the point of |
| 1081 // view of the SSL layer because the server will ignore the application | 1081 // view of the SSL layer because the server will ignore the application |
| 1082 // data in the Snap Start extension. However, at the HTTP layer, we have | 1082 // data in the Snap Start extension. However, at the HTTP layer, we have |
| 1083 // already decided that it's a HTTP or SPDY connection and it's easier to | 1083 // already decided that it's a HTTP or SPDY connection and it's easier to |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1251 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
| 1252 state); | 1252 state); |
| 1253 break; | 1253 break; |
| 1254 } | 1254 } |
| 1255 return description; | 1255 return description; |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 #undef STATE_CASE | 1258 #undef STATE_CASE |
| 1259 | 1259 |
| 1260 } // namespace net | 1260 } // namespace net |
| OLD | NEW |