| 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_proxy_client_socket.h" | 5 #include "net/http/http_proxy_client_socket.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 248 } |
| 249 | 249 |
| 250 int HttpProxyClientSocket::GetLocalAddress(IPEndPoint* address) const { | 250 int HttpProxyClientSocket::GetLocalAddress(IPEndPoint* address) const { |
| 251 return transport_->socket()->GetLocalAddress(address); | 251 return transport_->socket()->GetLocalAddress(address); |
| 252 } | 252 } |
| 253 | 253 |
| 254 int HttpProxyClientSocket::PrepareForAuthRestart() { | 254 int HttpProxyClientSocket::PrepareForAuthRestart() { |
| 255 if (!response_.headers.get()) | 255 if (!response_.headers.get()) |
| 256 return ERR_CONNECTION_RESET; | 256 return ERR_CONNECTION_RESET; |
| 257 | 257 |
| 258 // If the connection can't be reused, just return ERR_CONNECTION_CLOSED. | 258 // If the connection can't be reused, return |
| 259 // The request should be retried at a higher layer. | 259 // ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH. The request will be retried |
| 260 // at a higher layer. |
| 260 if (!response_.headers->IsKeepAlive() || | 261 if (!response_.headers->IsKeepAlive() || |
| 261 !http_stream_parser_->CanFindEndOfResponse() || | 262 !http_stream_parser_->CanFindEndOfResponse() || |
| 262 !transport_->socket()->IsConnected()) { | 263 !transport_->socket()->IsConnected()) { |
| 263 transport_->socket()->Disconnect(); | 264 transport_->socket()->Disconnect(); |
| 264 return ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH; | 265 return ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH; |
| 265 } | 266 } |
| 266 | 267 |
| 267 // If the auth request had a body, need to drain it before reusing the socket. | 268 // If the auth request had a body, need to drain it before reusing the socket. |
| 268 if (!http_stream_parser_->IsResponseBodyComplete()) { | 269 if (!http_stream_parser_->IsResponseBodyComplete()) { |
| 269 next_state_ = STATE_DRAIN_BODY; | 270 next_state_ = STATE_DRAIN_BODY; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 next_state_ = STATE_DRAIN_BODY; | 525 next_state_ = STATE_DRAIN_BODY; |
| 525 return OK; | 526 return OK; |
| 526 } | 527 } |
| 527 | 528 |
| 528 return DidDrainBodyForAuthRestart(); | 529 return DidDrainBodyForAuthRestart(); |
| 529 } | 530 } |
| 530 | 531 |
| 531 //---------------------------------------------------------------- | 532 //---------------------------------------------------------------- |
| 532 | 533 |
| 533 } // namespace net | 534 } // namespace net |
| OLD | NEW |