| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/trace_event.h" | 10 #include "base/trace_event.h" |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 // NOTE: we resend a request only if we reused a keep-alive connection. | 957 // NOTE: we resend a request only if we reused a keep-alive connection. |
| 958 // This automatically prevents an infinite resend loop because we'll run | 958 // This automatically prevents an infinite resend loop because we'll run |
| 959 // out of the cached keep-alive connections eventually. | 959 // out of the cached keep-alive connections eventually. |
| 960 if (establishing_tunnel_ || | 960 if (establishing_tunnel_ || |
| 961 !reused_socket_ || // We didn't reuse a keep-alive connection. | 961 !reused_socket_ || // We didn't reuse a keep-alive connection. |
| 962 header_buf_len_) { // We have received some response headers. | 962 header_buf_len_) { // We have received some response headers. |
| 963 return false; | 963 return false; |
| 964 } | 964 } |
| 965 connection_.set_socket(NULL); | 965 connection_.set_socket(NULL); |
| 966 connection_.Reset(); | 966 connection_.Reset(); |
| 967 // There are two reasons we need to clear request_headers_. 1) It contains |
| 968 // the real request headers, but we may need to resend the CONNECT request |
| 969 // first to recreate the SSL tunnel. 2) An empty request_headers_ causes |
| 970 // BuildRequestHeaders to be called, which rewinds request_body_stream_ to |
| 971 // the beginning of request_->upload_data. |
| 972 request_headers_.clear(); |
| 967 request_headers_bytes_sent_ = 0; | 973 request_headers_bytes_sent_ = 0; |
| 968 if (request_body_stream_.get()) | |
| 969 request_body_stream_->Reset(); | |
| 970 next_state_ = STATE_INIT_CONNECTION; // Resend the request. | 974 next_state_ = STATE_INIT_CONNECTION; // Resend the request. |
| 971 return true; | 975 return true; |
| 972 } | 976 } |
| 973 | 977 |
| 974 int HttpNetworkTransaction::ReconsiderProxyAfterError(int error) { | 978 int HttpNetworkTransaction::ReconsiderProxyAfterError(int error) { |
| 975 DCHECK(!pac_request_); | 979 DCHECK(!pac_request_); |
| 976 | 980 |
| 977 // A failure to resolve the hostname or any error related to establishing a | 981 // A failure to resolve the hostname or any error related to establishing a |
| 978 // TCP connection could be grounds for trying a new proxy configuration. | 982 // TCP connection could be grounds for trying a new proxy configuration. |
| 979 // | 983 // |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 auth_data_[target]->state = AUTH_STATE_NEED_AUTH; | 1098 auth_data_[target]->state = AUTH_STATE_NEED_AUTH; |
| 1095 } | 1099 } |
| 1096 | 1100 |
| 1097 response_.auth_challenge.swap(auth_info); | 1101 response_.auth_challenge.swap(auth_info); |
| 1098 auth_handler_[target].reset(auth_handler.release()); | 1102 auth_handler_[target].reset(auth_handler.release()); |
| 1099 | 1103 |
| 1100 return OK; | 1104 return OK; |
| 1101 } | 1105 } |
| 1102 | 1106 |
| 1103 } // namespace net | 1107 } // namespace net |
| OLD | NEW |