blob: 3cecb6b21e67cc7e38b1d65db27ac82dafc0c26d [file] [log] [blame]
// Copyright 2014 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.
#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 "url/gurl.h"
namespace net {
class HttpResponseHeaders;
class QuicSession;
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 {
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;
void ParseRequestHeaders();
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 HttpResponseHeaders& response_headers,
base::StringPiece body);
SpdyHeaderBlock headers_;
string body_;
GURL request_url_;
// Buffer into which response header data is read.
scoped_refptr<GrowableIOBuffer> read_buf_;
bool request_headers_received_;
} // namespace net