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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 case 200: // OK | 403 case 200: // OK |
404 next_state_ = STATE_OPEN; | 404 next_state_ = STATE_OPEN; |
405 return OK; | 405 return OK; |
406 | 406 |
407 case 302: // Found / Moved Temporarily | 407 case 302: // Found / Moved Temporarily |
408 // Try to return a sanitized response so we can follow auth redirects. | 408 // Try to return a sanitized response so we can follow auth redirects. |
409 // If we can't, fail the tunnel connection. | 409 // If we can't, fail the tunnel connection. |
410 if (SanitizeProxyRedirect(&response_, request_.url)) { | 410 if (SanitizeProxyRedirect(&response_, request_.url)) { |
411 redirect_has_load_timing_info_ = | 411 redirect_has_load_timing_info_ = |
412 spdy_stream_->GetLoadTimingInfo(&redirect_load_timing_info_); | 412 spdy_stream_->GetLoadTimingInfo(&redirect_load_timing_info_); |
| 413 // Note that this triggers a RST_STREAM_CANCEL. |
413 spdy_stream_->DetachDelegate(); | 414 spdy_stream_->DetachDelegate(); |
414 next_state_ = STATE_DISCONNECTED; | 415 next_state_ = STATE_DISCONNECTED; |
415 return ERR_HTTPS_PROXY_TUNNEL_RESPONSE; | 416 return ERR_HTTPS_PROXY_TUNNEL_RESPONSE; |
416 } else { | 417 } else { |
417 LogBlockedTunnelResponse(); | 418 LogBlockedTunnelResponse(); |
418 return ERR_TUNNEL_CONNECTION_FAILED; | 419 return ERR_TUNNEL_CONNECTION_FAILED; |
419 } | 420 } |
420 | 421 |
421 case 407: // Proxy Authentication Required | 422 case 407: // Proxy Authentication Required |
422 next_state_ = STATE_OPEN; | 423 next_state_ = STATE_OPEN; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 } else if (!read_callback_.is_null()) { | 517 } else if (!read_callback_.is_null()) { |
517 // If we have a read_callback_, the we need to make sure we call it back. | 518 // If we have a read_callback_, the we need to make sure we call it back. |
518 OnDataReceived(scoped_ptr<SpdyBuffer>()); | 519 OnDataReceived(scoped_ptr<SpdyBuffer>()); |
519 } | 520 } |
520 // This may have been deleted by read_callback_, so check first. | 521 // This may have been deleted by read_callback_, so check first. |
521 if (weak_ptr.get() && !write_callback.is_null()) | 522 if (weak_ptr.get() && !write_callback.is_null()) |
522 write_callback.Run(ERR_CONNECTION_CLOSED); | 523 write_callback.Run(ERR_CONNECTION_CLOSED); |
523 } | 524 } |
524 | 525 |
525 } // namespace net | 526 } // namespace net |
OLD | NEW |