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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // 501 response bodies that contain a useful error message. For | 504 // 501 response bodies that contain a useful error message. For |
505 // example, Squid uses a 404 response to report the DNS error: "The | 505 // example, Squid uses a 404 response to report the DNS error: "The |
506 // domain name does not exist." | 506 // domain name does not exist." |
507 LogBlockedTunnelResponse(); | 507 LogBlockedTunnelResponse(); |
508 return ERR_TUNNEL_CONNECTION_FAILED; | 508 return ERR_TUNNEL_CONNECTION_FAILED; |
509 } | 509 } |
510 } | 510 } |
511 | 511 |
512 int HttpProxyClientSocket::DoDrainBody() { | 512 int HttpProxyClientSocket::DoDrainBody() { |
513 DCHECK(drain_buf_.get()); | 513 DCHECK(drain_buf_.get()); |
514 DCHECK(transport_->is_initialized()); | |
515 next_state_ = STATE_DRAIN_BODY_COMPLETE; | 514 next_state_ = STATE_DRAIN_BODY_COMPLETE; |
516 return http_stream_parser_->ReadResponseBody( | 515 return http_stream_parser_->ReadResponseBody( |
517 drain_buf_.get(), kDrainBodyBufferSize, io_callback_); | 516 drain_buf_.get(), kDrainBodyBufferSize, io_callback_); |
518 } | 517 } |
519 | 518 |
520 int HttpProxyClientSocket::DoDrainBodyComplete(int result) { | 519 int HttpProxyClientSocket::DoDrainBodyComplete(int result) { |
521 if (result < 0) | 520 if (result < 0) |
522 return ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH; | 521 return ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH; |
523 | 522 |
524 if (!http_stream_parser_->IsResponseBodyComplete()) { | 523 if (!http_stream_parser_->IsResponseBodyComplete()) { |
525 // Keep draining. | 524 // Keep draining. |
526 next_state_ = STATE_DRAIN_BODY; | 525 next_state_ = STATE_DRAIN_BODY; |
527 return OK; | 526 return OK; |
528 } | 527 } |
529 | 528 |
530 return DidDrainBodyForAuthRestart(); | 529 return DidDrainBodyForAuthRestart(); |
531 } | 530 } |
532 | 531 |
533 //---------------------------------------------------------------- | 532 //---------------------------------------------------------------- |
534 | 533 |
535 } // namespace net | 534 } // namespace net |
OLD | NEW |