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 #ifndef NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ | 5 #ifndef NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ |
6 #define NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ | 6 #define NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // All this does right now is aggregate data, and on fin, send an HTTP | 25 // All this does right now is aggregate data, and on fin, send an HTTP |
26 // response. | 26 // response. |
27 class QuicSpdyServerStream : public QuicDataStream { | 27 class QuicSpdyServerStream : public QuicDataStream { |
28 public: | 28 public: |
29 QuicSpdyServerStream(QuicStreamId id, QuicSession* session); | 29 QuicSpdyServerStream(QuicStreamId id, QuicSession* session); |
30 virtual ~QuicSpdyServerStream(); | 30 virtual ~QuicSpdyServerStream(); |
31 | 31 |
32 // ReliableQuicStream implementation called by the session when there's | 32 // ReliableQuicStream implementation called by the session when there's |
33 // data for us. | 33 // data for us. |
34 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; | 34 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; |
35 | 35 virtual void OnFinRead() OVERRIDE; |
36 virtual void SendHeaders(const BalsaHeaders& response_headers); | |
37 | 36 |
38 int ParseRequestHeaders(); | 37 int ParseRequestHeaders(); |
39 | 38 |
| 39 private: |
| 40 friend class test::QuicSpdyServerStreamPeer; |
| 41 |
40 // Sends a basic 200 response using SendHeaders for the headers and WriteData | 42 // Sends a basic 200 response using SendHeaders for the headers and WriteData |
41 // for the body. | 43 // for the body. |
42 void SendResponse(); | 44 void SendResponse(); |
43 | 45 |
44 // Sends a basic 500 response using SendHeaders for the headers and WriteData | 46 // Sends a basic 500 response using SendHeaders for the headers and WriteData |
45 // for the body | 47 // for the body |
46 void SendErrorResponse(); | 48 void SendErrorResponse(); |
47 | 49 |
48 // Returns whatever headers have been received for this stream. | |
49 const BalsaHeaders& headers() { return headers_; } | |
50 | |
51 const string& body() { return body_; } | |
52 | |
53 protected: | |
54 virtual void OnFinRead() OVERRIDE; | |
55 | |
56 private: | |
57 friend class test::QuicSpdyServerStreamPeer; | |
58 | |
59 void SendHeadersAndBody(const BalsaHeaders& response_headers, | 50 void SendHeadersAndBody(const BalsaHeaders& response_headers, |
60 base::StringPiece data); | 51 base::StringPiece body); |
61 | 52 |
62 BalsaHeaders headers_; | 53 BalsaHeaders headers_; |
63 string body_; | 54 string body_; |
64 | 55 |
65 // Buffer into which response header data is read. | 56 // Buffer into which response header data is read. |
66 scoped_refptr<GrowableIOBuffer> read_buf_; | 57 scoped_refptr<GrowableIOBuffer> read_buf_; |
67 bool request_headers_received_; | 58 bool request_headers_received_; |
68 }; | 59 }; |
69 | 60 |
70 } // namespace tools | 61 } // namespace tools |
71 } // namespace net | 62 } // namespace net |
72 | 63 |
73 #endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ | 64 #endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ |
OLD | NEW |