| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/field_trial.h" | 9 #include "base/field_trial.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 chunked_decoder_.reset(); | 1547 chunked_decoder_.reset(); |
| 1548 // Reset all the members of response_. | 1548 // Reset all the members of response_. |
| 1549 response_ = HttpResponseInfo(); | 1549 response_ = HttpResponseInfo(); |
| 1550 } | 1550 } |
| 1551 | 1551 |
| 1552 bool HttpNetworkTransaction::ShouldResendRequest() const { | 1552 bool HttpNetworkTransaction::ShouldResendRequest() const { |
| 1553 // NOTE: we resend a request only if we reused a keep-alive connection. | 1553 // NOTE: we resend a request only if we reused a keep-alive connection. |
| 1554 // This automatically prevents an infinite resend loop because we'll run | 1554 // This automatically prevents an infinite resend loop because we'll run |
| 1555 // out of the cached keep-alive connections eventually. | 1555 // out of the cached keep-alive connections eventually. |
| 1556 if (establishing_tunnel_ || | 1556 if (establishing_tunnel_ || |
| 1557 !reused_socket_ || // We didn't reuse a keep-alive connection. | 1557 // We used a socket that was never idle. |
| 1558 connection_.reuse_type() == ClientSocketHandle::UNUSED || |
| 1558 header_buf_len_) { // We have received some response headers. | 1559 header_buf_len_) { // We have received some response headers. |
| 1559 return false; | 1560 return false; |
| 1560 } | 1561 } |
| 1561 return true; | 1562 return true; |
| 1562 } | 1563 } |
| 1563 | 1564 |
| 1564 void HttpNetworkTransaction::ResetConnectionAndRequestForResend() { | 1565 void HttpNetworkTransaction::ResetConnectionAndRequestForResend() { |
| 1565 connection_.socket()->Disconnect(); | 1566 connection_.socket()->Disconnect(); |
| 1566 connection_.Reset(); | 1567 connection_.Reset(); |
| 1567 // There are two reasons we need to clear request_headers_. 1) It contains | 1568 // There are two reasons we need to clear request_headers_. 1) It contains |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 host_and_port = proxy_info_.proxy_server().host_and_port(); | 1895 host_and_port = proxy_info_.proxy_server().host_and_port(); |
| 1895 } else { | 1896 } else { |
| 1896 DCHECK(target == HttpAuth::AUTH_SERVER); | 1897 DCHECK(target == HttpAuth::AUTH_SERVER); |
| 1897 host_and_port = GetHostAndPort(request_->url); | 1898 host_and_port = GetHostAndPort(request_->url); |
| 1898 } | 1899 } |
| 1899 auth_info->host_and_port = ASCIIToWide(host_and_port); | 1900 auth_info->host_and_port = ASCIIToWide(host_and_port); |
| 1900 response_.auth_challenge = auth_info; | 1901 response_.auth_challenge = auth_info; |
| 1901 } | 1902 } |
| 1902 | 1903 |
| 1903 } // namespace net | 1904 } // namespace net |
| OLD | NEW |