Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: net/tools/quic/quic_spdy_server_stream.h

Issue 111073003: Cleanup of QUIC stream classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "net/tools/quic/quic_reliable_server_stream.h" 11 #include "net/quic/quic_protocol.h"
12 #include "net/quic/reliable_quic_stream.h"
13 #include "net/tools/balsa/balsa_headers.h"
12 14
13 namespace net { 15 namespace net {
14 16
15 class QuicSession; 17 class QuicSession;
16 18
17 namespace tools { 19 namespace tools {
18 20
19 // All this does right now is aggregate data, and on fin, send a cached 21 namespace test {
22 class QuicSpdyServerStreamPeer;
23 } // namespace test
24
25 // All this does right now is aggregate data, and on fin, send an HTTP
20 // response. 26 // response.
21 class QuicSpdyServerStream : public QuicReliableServerStream { 27 class QuicSpdyServerStream : public ReliableQuicStream {
22 public: 28 public:
23 QuicSpdyServerStream(QuicStreamId id, QuicSession* session); 29 QuicSpdyServerStream(QuicStreamId id, QuicSession* session);
24 virtual ~QuicSpdyServerStream(); 30 virtual ~QuicSpdyServerStream();
25 31
26 // ReliableQuicStream implementation called by the session when there's 32 // ReliableQuicStream implementation called by the session when there's
27 // data for us. 33 // data for us.
28 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE; 34 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE;
29 35
30 virtual void SendHeaders(const BalsaHeaders& response_headers) OVERRIDE; 36 virtual void SendHeaders(const BalsaHeaders& response_headers);
31 37
32 int ParseRequestHeaders(); 38 int ParseRequestHeaders();
33 39
40 // Sends a basic 200 response using SendHeaders for the headers and WriteData
41 // for the body.
42 void SendResponse();
43 // Sends a basic 500 response using SendHeaders for the headers and WriteData
44 // for the body
45 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
49 // Returns whatever headers have been received for this stream.
50 const BalsaHeaders& headers() { return headers_; }
51
52 const string& body() { return body_; }
53
34 protected: 54 protected:
35 virtual void OnFinRead() OVERRIDE; 55 virtual void OnFinRead() OVERRIDE;
36 56
57 private:
58 friend class test::QuicSpdyServerStreamPeer;
59
60 BalsaHeaders headers_;
61 string body_;
62
37 // Buffer into which response header data is read. 63 // Buffer into which response header data is read.
38 scoped_refptr<GrowableIOBuffer> read_buf_; 64 scoped_refptr<GrowableIOBuffer> read_buf_;
39 bool request_headers_received_; 65 bool request_headers_received_;
40 }; 66 };
41 67
42 } // namespace tools 68 } // namespace tools
43 } // namespace net 69 } // namespace net
44 70
45 #endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_ 71 #endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_spdy_client_stream_test.cc ('k') | net/tools/quic/quic_spdy_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698