| 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/spdy/spdy_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
| 6 | 6 |
| 7 #include <algorithm> // min | 7 #include <algorithm> // min |
| 8 #include <memory> |
| 8 #include <utility> | 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 12 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
| 13 #include "base/location.h" | 14 #include "base/location.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 case 302: // Found / Moved Temporarily | 400 case 302: // Found / Moved Temporarily |
| 400 // Try to return a sanitized response so we can follow auth redirects. | 401 // Try to return a sanitized response so we can follow auth redirects. |
| 401 // If we can't, fail the tunnel connection. | 402 // If we can't, fail the tunnel connection. |
| 402 if (!SanitizeProxyRedirect(&response_)) { | 403 if (!SanitizeProxyRedirect(&response_)) { |
| 403 LogBlockedTunnelResponse(); | 404 LogBlockedTunnelResponse(); |
| 404 return ERR_TUNNEL_CONNECTION_FAILED; | 405 return ERR_TUNNEL_CONNECTION_FAILED; |
| 405 } | 406 } |
| 406 | 407 |
| 407 redirect_has_load_timing_info_ = | 408 redirect_has_load_timing_info_ = |
| 408 spdy_stream_->GetLoadTimingInfo(&redirect_load_timing_info_); | 409 spdy_stream_->GetLoadTimingInfo(&redirect_load_timing_info_); |
| 409 // Note that this triggers a RST_STREAM_CANCEL. | 410 // Note that this triggers a ERROR_CODE_CANCEL. |
| 410 spdy_stream_->DetachDelegate(); | 411 spdy_stream_->DetachDelegate(); |
| 411 next_state_ = STATE_DISCONNECTED; | 412 next_state_ = STATE_DISCONNECTED; |
| 412 return ERR_HTTPS_PROXY_TUNNEL_RESPONSE; | 413 return ERR_HTTPS_PROXY_TUNNEL_RESPONSE; |
| 413 | 414 |
| 414 case 407: // Proxy Authentication Required | 415 case 407: // Proxy Authentication Required |
| 415 next_state_ = STATE_OPEN; | 416 next_state_ = STATE_OPEN; |
| 416 if (!SanitizeProxyAuth(&response_)) { | 417 if (!SanitizeProxyAuth(&response_)) { |
| 417 LogBlockedTunnelResponse(); | 418 LogBlockedTunnelResponse(); |
| 418 return ERR_TUNNEL_CONNECTION_FAILED; | 419 return ERR_TUNNEL_CONNECTION_FAILED; |
| 419 } | 420 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 } else if (!read_callback_.is_null()) { | 521 } else if (!read_callback_.is_null()) { |
| 521 // If we have a read_callback_, the we need to make sure we call it back. | 522 // If we have a read_callback_, the we need to make sure we call it back. |
| 522 OnDataReceived(std::unique_ptr<SpdyBuffer>()); | 523 OnDataReceived(std::unique_ptr<SpdyBuffer>()); |
| 523 } | 524 } |
| 524 // This may have been deleted by read_callback_, so check first. | 525 // This may have been deleted by read_callback_, so check first. |
| 525 if (weak_ptr.get() && !write_callback.is_null()) | 526 if (weak_ptr.get() && !write_callback.is_null()) |
| 526 write_callback.Run(ERR_CONNECTION_CLOSED); | 527 write_callback.Run(ERR_CONNECTION_CLOSED); |
| 527 } | 528 } |
| 528 | 529 |
| 529 } // namespace net | 530 } // namespace net |
| OLD | NEW |