blob: 029e25fd0f67ed9d7ad79dd99b97e3a46fccea7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_
#define NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_
#include <string>
#include "base/basictypes.h"
#include "net/base/io_buffer.h"
#include "net/quic/quic_data_stream.h"
#include "net/quic/quic_protocol.h"
#include "net/tools/balsa/balsa_headers.h"
namespace net {
class QuicSession;
namespace tools {
namespace test {
class QuicSpdyServerStreamPeer;
} // namespace test
// All this does right now is aggregate data, and on fin, send an HTTP
// response.
class QuicSpdyServerStream : public QuicDataStream {
public:
QuicSpdyServerStream(QuicStreamId id, QuicSession* session);
virtual ~QuicSpdyServerStream();
// ReliableQuicStream implementation called by the session when there's
// data for us.
virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE;
virtual void OnFinRead() OVERRIDE;
int ParseRequestHeaders();
private:
friend class test::QuicSpdyServerStreamPeer;
// Sends a basic 200 response using SendHeaders for the headers and WriteData
// for the body.
void SendResponse();
// Sends a basic 500 response using SendHeaders for the headers and WriteData
// for the body
void SendErrorResponse();
void SendHeadersAndBody(const BalsaHeaders& response_headers,
base::StringPiece body);
BalsaHeaders headers_;
string body_;
// Buffer into which response header data is read.
scoped_refptr<GrowableIOBuffer> read_buf_;
bool request_headers_received_;
};
} // namespace tools
} // namespace net
#endif // NET_TOOLS_QUIC_QUIC_SPDY_SERVER_STREAM_H_
|