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 22 matching lines...) Expand all Loading... |
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 |
36 virtual void SendHeaders(const BalsaHeaders& response_headers); | 36 virtual void SendHeaders(const BalsaHeaders& response_headers); |
37 | 37 |
38 int ParseRequestHeaders(); | 38 int ParseRequestHeaders(); |
39 | 39 |
40 // Sends a basic 200 response using SendHeaders for the headers and WriteData | 40 // Sends a basic 200 response using SendHeaders for the headers and WriteData |
41 // for the body. | 41 // for the body. |
42 void SendResponse(); | 42 void SendResponse(); |
| 43 |
43 // Sends a basic 500 response using SendHeaders for the headers and WriteData | 44 // Sends a basic 500 response using SendHeaders for the headers and WriteData |
44 // for the body | 45 // for the body |
45 void SendErrorResponse(); | 46 void SendErrorResponse(); |
46 // Make sure that as soon as we start writing data, we stop reading. | |
47 virtual QuicConsumedData WriteData(base::StringPiece data, bool fin) OVERRIDE; | |
48 | 47 |
49 // Returns whatever headers have been received for this stream. | 48 // Returns whatever headers have been received for this stream. |
50 const BalsaHeaders& headers() { return headers_; } | 49 const BalsaHeaders& headers() { return headers_; } |
51 | 50 |
52 const string& body() { return body_; } | 51 const string& body() { return body_; } |
53 | 52 |
54 protected: | 53 protected: |
55 virtual void OnFinRead() OVERRIDE; | 54 virtual void OnFinRead() OVERRIDE; |
56 | 55 |
57 private: | 56 private: |
58 friend class test::QuicSpdyServerStreamPeer; | 57 friend class test::QuicSpdyServerStreamPeer; |
59 | 58 |
| 59 void SendHeadersAndBody(const BalsaHeaders& response_headers, |
| 60 base::StringPiece data); |
| 61 |
60 BalsaHeaders headers_; | 62 BalsaHeaders headers_; |
61 string body_; | 63 string body_; |
62 | 64 |
63 // Buffer into which response header data is read. | 65 // Buffer into which response header data is read. |
64 scoped_refptr<GrowableIOBuffer> read_buf_; | 66 scoped_refptr<GrowableIOBuffer> read_buf_; |
65 bool request_headers_received_; | 67 bool request_headers_received_; |
66 }; | 68 }; |
67 | 69 |
68 } // namespace tools | 70 } // namespace tools |
69 } // namespace net | 71 } // namespace net |
70 | 72 |
71 #endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ | 73 #endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ |
OLD | NEW |