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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 481 |
482 // Save the response | 482 // Save the response |
483 if (!SpdyHeadersToHttpResponse( | 483 if (!SpdyHeadersToHttpResponse( |
484 response, spdy_stream_->GetProtocolVersion(), &response_)) | 484 response, spdy_stream_->GetProtocolVersion(), &response_)) |
485 return ERR_INCOMPLETE_SPDY_HEADERS; | 485 return ERR_INCOMPLETE_SPDY_HEADERS; |
486 | 486 |
487 OnIOComplete(status); | 487 OnIOComplete(status); |
488 return OK; | 488 return OK; |
489 } | 489 } |
490 | 490 |
| 491 void SpdyProxyClientSocket::OnHeadersSent() { |
| 492 // Proxy client sockets don't send any HEADERS frame. |
| 493 NOTREACHED(); |
| 494 } |
| 495 |
491 // Called when data is received. | 496 // Called when data is received. |
492 void SpdyProxyClientSocket::OnDataReceived(const char* data, int length) { | 497 void SpdyProxyClientSocket::OnDataReceived(const char* data, int length) { |
493 if (length > 0) { | 498 if (length > 0) { |
494 // Save the received data. | 499 // Save the received data. |
495 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length)); | 500 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length)); |
496 memcpy(io_buffer->data(), data, length); | 501 memcpy(io_buffer->data(), data, length); |
497 read_buffer_.push_back( | 502 read_buffer_.push_back( |
498 make_scoped_refptr(new DrainableIOBuffer(io_buffer, length))); | 503 make_scoped_refptr(new DrainableIOBuffer(io_buffer, length))); |
499 } | 504 } |
500 | 505 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } else if (!read_callback_.is_null()) { | 557 } else if (!read_callback_.is_null()) { |
553 // If we have a read_callback_, the we need to make sure we call it back. | 558 // If we have a read_callback_, the we need to make sure we call it back. |
554 OnDataReceived(NULL, 0); | 559 OnDataReceived(NULL, 0); |
555 } | 560 } |
556 // This may have been deleted by read_callback_, so check first. | 561 // This may have been deleted by read_callback_, so check first. |
557 if (weak_ptr && !write_callback.is_null()) | 562 if (weak_ptr && !write_callback.is_null()) |
558 write_callback.Run(ERR_CONNECTION_CLOSED); | 563 write_callback.Run(ERR_CONNECTION_CLOSED); |
559 } | 564 } |
560 | 565 |
561 } // namespace net | 566 } // namespace net |
OLD | NEW |