| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 // Ignore response to avoid letting the proxy impersonate the target | 428 // Ignore response to avoid letting the proxy impersonate the target |
| 429 // server. (See http://crbug.com/137891.) | 429 // server. (See http://crbug.com/137891.) |
| 430 LogBlockedTunnelResponse(); | 430 LogBlockedTunnelResponse(); |
| 431 return ERR_TUNNEL_CONNECTION_FAILED; | 431 return ERR_TUNNEL_CONNECTION_FAILED; |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 // SpdyStream::Delegate methods: | 435 // SpdyStream::Delegate methods: |
| 436 // Called when SYN frame has been sent. | 436 // Called when SYN frame has been sent. |
| 437 // Returns true if no more data to be sent after SYN frame. | 437 // Returns true if no more data to be sent after SYN frame. |
| 438 SpdySendStatus SpdyProxyClientSocket::OnSendRequestHeadersComplete() { | 438 void SpdyProxyClientSocket::OnSendRequestHeadersComplete() { |
| 439 DCHECK_EQ(next_state_, STATE_SEND_REQUEST_COMPLETE); | 439 DCHECK_EQ(next_state_, STATE_SEND_REQUEST_COMPLETE); |
| 440 | 440 |
| 441 OnIOComplete(OK); | 441 OnIOComplete(OK); |
| 442 | |
| 443 // We return true here so that we send |spdy_stream_| into | |
| 444 // STATE_OPEN (ala WebSockets). | |
| 445 return NO_MORE_DATA_TO_SEND; | |
| 446 } | 442 } |
| 447 | 443 |
| 448 void SpdyProxyClientSocket::OnSendBody() { | 444 void SpdyProxyClientSocket::OnSendBody() { |
| 449 // Because we use |spdy_stream_| via STATE_OPEN (ala WebSockets) | 445 // Because we use |spdy_stream_| via STATE_OPEN (ala WebSockets) |
| 450 // OnSendBody() must never be called. | 446 // OnSendBody() must never be called. |
| 451 CHECK(false); | 447 CHECK(false); |
| 452 } | 448 } |
| 453 | 449 |
| 454 void SpdyProxyClientSocket::OnSendBodyComplete() { | 450 void SpdyProxyClientSocket::OnSendBodyComplete() { |
| 455 // Because we use |spdy_stream_| via STATE_OPEN (ala WebSockets) | 451 // Because we use |spdy_stream_| via STATE_OPEN (ala WebSockets) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } else if (!read_callback_.is_null()) { | 528 } else if (!read_callback_.is_null()) { |
| 533 // If we have a read_callback_, the we need to make sure we call it back. | 529 // If we have a read_callback_, the we need to make sure we call it back. |
| 534 OnDataReceived(scoped_ptr<SpdyBuffer>()); | 530 OnDataReceived(scoped_ptr<SpdyBuffer>()); |
| 535 } | 531 } |
| 536 // This may have been deleted by read_callback_, so check first. | 532 // This may have been deleted by read_callback_, so check first. |
| 537 if (weak_ptr && !write_callback.is_null()) | 533 if (weak_ptr && !write_callback.is_null()) |
| 538 write_callback.Run(ERR_CONNECTION_CLOSED); | 534 write_callback.Run(ERR_CONNECTION_CLOSED); |
| 539 } | 535 } |
| 540 | 536 |
| 541 } // namespace net | 537 } // namespace net |
| OLD | NEW |