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_
10 #include "base/basictypes.h"
11 #include "net/quic/quic_data_stream.h"
12 #include "net/quic/quic_protocol.h"
13 #include "net/spdy/spdy_framer.h"
22 class QuicSpdyServerStreamPeer
;
25 // All this does right now is aggregate data, and on fin, send an HTTP
27 class QuicSpdyServerStream
: public QuicDataStream
{
29 QuicSpdyServerStream(QuicStreamId id
, QuicSession
* session
);
30 ~QuicSpdyServerStream() override
;
32 // ReliableQuicStream implementation called by the session when there's
34 uint32
ProcessData(const char* data
, uint32 data_len
) override
;
35 void OnFinRead() override
;
38 friend class test::QuicSpdyServerStreamPeer
;
40 // Parses the request headers from |data| to |request_headers_|.
41 // Returns false if there was an error parsing the headers.
42 bool ParseRequestHeaders(const char* data
, uint32 data_len
);
44 // Sends a basic 200 response using SendHeaders for the headers and WriteData
48 // Sends a basic 500 response using SendHeaders for the headers and WriteData
50 void SendErrorResponse();
52 void SendHeadersAndBody(const SpdyHeaderBlock
& response_headers
,
53 base::StringPiece body
);
55 // The parsed headers received from the client.
56 SpdyHeaderBlock request_headers_
;
60 DISALLOW_COPY_AND_ASSIGN(QuicSpdyServerStream
);
66 #endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_