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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 // Save the response | 506 // Save the response |
507 if (!SpdyHeadersToHttpResponse( | 507 if (!SpdyHeadersToHttpResponse( |
508 response, spdy_stream_->GetProtocolVersion(), &response_)) | 508 response, spdy_stream_->GetProtocolVersion(), &response_)) |
509 return ERR_INCOMPLETE_SPDY_HEADERS; | 509 return ERR_INCOMPLETE_SPDY_HEADERS; |
510 | 510 |
511 OnIOComplete(status); | 511 OnIOComplete(status); |
512 return OK; | 512 return OK; |
513 } | 513 } |
514 | 514 |
| 515 void SpdyProxyClientSocket::OnHeadersSent() { |
| 516 // Proxy client sockets don't send any HEADERS frame. |
| 517 NOTREACHED(); |
| 518 } |
| 519 |
515 // Called when data is received. | 520 // Called when data is received. |
516 int SpdyProxyClientSocket::OnDataReceived(const char* data, int length) { | 521 int SpdyProxyClientSocket::OnDataReceived(const char* data, int length) { |
517 if (length > 0) { | 522 if (length > 0) { |
518 // Save the received data. | 523 // Save the received data. |
519 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length)); | 524 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length)); |
520 memcpy(io_buffer->data(), data, length); | 525 memcpy(io_buffer->data(), data, length); |
521 read_buffer_.push_back( | 526 read_buffer_.push_back( |
522 make_scoped_refptr(new DrainableIOBuffer(io_buffer, length))); | 527 make_scoped_refptr(new DrainableIOBuffer(io_buffer, length))); |
523 } | 528 } |
524 | 529 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } else if (!read_callback_.is_null()) { | 582 } else if (!read_callback_.is_null()) { |
578 // If we have a read_callback_, the we need to make sure we call it back. | 583 // If we have a read_callback_, the we need to make sure we call it back. |
579 OnDataReceived(NULL, 0); | 584 OnDataReceived(NULL, 0); |
580 } | 585 } |
581 // This may have been deleted by read_callback_, so check first. | 586 // This may have been deleted by read_callback_, so check first. |
582 if (weak_ptr && !write_callback.is_null()) | 587 if (weak_ptr && !write_callback.is_null()) |
583 write_callback.Run(ERR_CONNECTION_CLOSED); | 588 write_callback.Run(ERR_CONNECTION_CLOSED); |
584 } | 589 } |
585 | 590 |
586 } // namespace net | 591 } // namespace net |
OLD | NEW |