Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / tools / quic / quic_spdy_server_stream.h
blobc8167d1f9fb6c88e17cbbe6f6cb215bca3be369e
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
3 // found in the LICENSE file.
5 #ifndef NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_
6 #define NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "net/base/io_buffer.h"
12 #include "net/quic/quic_data_stream.h"
13 #include "net/quic/quic_protocol.h"
14 #include "net/tools/balsa/balsa_headers.h"
16 namespace net {
18 class QuicSession;
20 namespace tools {
22 namespace test {
23 class QuicSpdyServerStreamPeer;
24 } // namespace test
26 // All this does right now is aggregate data, and on fin, send an HTTP
27 // response.
28 class QuicSpdyServerStream : public QuicDataStream {
29 public:
30 QuicSpdyServerStream(QuicStreamId id, QuicSession* session);
31 virtual ~QuicSpdyServerStream();
33 // ReliableQuicStream implementation called by the session when there's
34 // data for us.
35 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE;
36 virtual void OnFinRead() OVERRIDE;
38 void ParseRequestHeaders();
40 private:
41 friend class test::QuicSpdyServerStreamPeer;
43 // Sends a basic 200 response using SendHeaders for the headers and WriteData
44 // for the body.
45 void SendResponse();
47 // Sends a basic 500 response using SendHeaders for the headers and WriteData
48 // for the body
49 void SendErrorResponse();
51 void SendHeadersAndBody(const BalsaHeaders& response_headers,
52 base::StringPiece body);
54 BalsaHeaders headers_;
55 string body_;
57 // Buffer into which response header data is read.
58 scoped_refptr<GrowableIOBuffer> read_buf_;
59 bool request_headers_received_;
61 DISALLOW_COPY_AND_ASSIGN(QuicSpdyServerStream);
64 } // namespace tools
65 } // namespace net
67 #endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_