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_RELIABLE_CLIENT_STREAM_H_
6 #define NET_TOOLS_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_
11 #include "base/strings/string_piece.h"
12 #include "net/quic/quic_protocol.h"
13 #include "net/quic/reliable_quic_stream.h"
14 #include "net/tools/balsa/balsa_frame.h"
15 #include "net/tools/balsa/balsa_headers.h"
23 class QuicClientSession;
25 // A base class for spdy/http client streams which handles the concept
26 // of sending and receiving headers and bodies.
27 class QuicReliableClientStream : public ReliableQuicStream {
29 QuicReliableClientStream(QuicStreamId id, QuicSession* session)
30 : ReliableQuicStream(id, session) {
33 // Serializes the headers and body, sends it to the server, and
34 // returns the number of bytes sent.
35 virtual ssize_t SendRequest(const BalsaHeaders& headers,
36 base::StringPiece body,
38 // Sends body data to the server and returns the number of bytes sent.
39 virtual ssize_t SendBody(const std::string& data, bool fin);
41 // Override the base class to close the Write side as soon as we get a
43 // SPDY/HTTP do not support bidirectional streaming.
44 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE;
46 // Returns the response data.
47 const std::string& data() { return data_; }
49 // Returns whatever headers have been received for this stream.
50 const BalsaHeaders& headers() { return headers_; }
53 std::string* mutable_data() { return &data_; }
54 BalsaHeaders* mutable_headers() { return &headers_; }
57 BalsaHeaders headers_;
60 DISALLOW_COPY_AND_ASSIGN(QuicReliableClientStream);
66 #endif // NET_TOOLS_QUIC_QUIC_RELIABLE_CLIENT_STREAM_H_