| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 471 |
| 472 // Save the response | 472 // Save the response |
| 473 if (!SpdyHeadersToHttpResponse( | 473 if (!SpdyHeadersToHttpResponse( |
| 474 response, spdy_stream_->GetProtocolVersion(), &response_)) | 474 response, spdy_stream_->GetProtocolVersion(), &response_)) |
| 475 return ERR_INCOMPLETE_SPDY_HEADERS; | 475 return ERR_INCOMPLETE_SPDY_HEADERS; |
| 476 | 476 |
| 477 OnIOComplete(status); | 477 OnIOComplete(status); |
| 478 return OK; | 478 return OK; |
| 479 } | 479 } |
| 480 | 480 |
| 481 void SpdyProxyClientSocket::OnHeadersSent() { | |
| 482 // Proxy client sockets don't send any HEADERS frame. | |
| 483 NOTREACHED(); | |
| 484 } | |
| 485 | |
| 486 // Called when data is received or on EOF (if |buffer| is NULL). | 481 // Called when data is received or on EOF (if |buffer| is NULL). |
| 487 int SpdyProxyClientSocket::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { | 482 int SpdyProxyClientSocket::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { |
| 488 if (buffer) { | 483 if (buffer) { |
| 489 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, | 484 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, |
| 490 buffer->GetRemainingSize(), | 485 buffer->GetRemainingSize(), |
| 491 buffer->GetRemainingData()); | 486 buffer->GetRemainingData()); |
| 492 read_buffer_queue_.Enqueue(buffer.Pass()); | 487 read_buffer_queue_.Enqueue(buffer.Pass()); |
| 493 } else { | 488 } else { |
| 494 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, 0, NULL); | 489 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, 0, NULL); |
| 495 } | 490 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } else if (!read_callback_.is_null()) { | 534 } else if (!read_callback_.is_null()) { |
| 540 // If we have a read_callback_, the we need to make sure we call it back. | 535 // If we have a read_callback_, the we need to make sure we call it back. |
| 541 OnDataReceived(scoped_ptr<SpdyBuffer>()); | 536 OnDataReceived(scoped_ptr<SpdyBuffer>()); |
| 542 } | 537 } |
| 543 // This may have been deleted by read_callback_, so check first. | 538 // This may have been deleted by read_callback_, so check first. |
| 544 if (weak_ptr && !write_callback.is_null()) | 539 if (weak_ptr && !write_callback.is_null()) |
| 545 write_callback.Run(ERR_CONNECTION_CLOSED); | 540 write_callback.Run(ERR_CONNECTION_CLOSED); |
| 546 } | 541 } |
| 547 | 542 |
| 548 } // namespace net | 543 } // namespace net |
| OLD | NEW |