OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_TOOLS_QUIC_QUIC_SPDY_CLIENT_STREAM_H_ | 5 #ifndef NET_TOOLS_QUIC_QUIC_SPDY_CLIENT_STREAM_H_ |
6 #define NET_TOOLS_QUIC_QUIC_SPDY_CLIENT_STREAM_H_ | 6 #define NET_TOOLS_QUIC_QUIC_SPDY_CLIENT_STREAM_H_ |
7 | 7 |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "net/quic/quic_data_stream.h" | |
14 #include "net/quic/quic_protocol.h" | 13 #include "net/quic/quic_protocol.h" |
| 14 #include "net/quic/quic_spdy_stream.h" |
15 #include "net/spdy/spdy_framer.h" | 15 #include "net/spdy/spdy_framer.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 namespace tools { | 18 namespace tools { |
19 | 19 |
20 class QuicClientSession; | 20 class QuicClientSession; |
21 | 21 |
22 // All this does right now is send an SPDY request, and aggregate the | 22 // All this does right now is send an SPDY request, and aggregate the |
23 // SPDY response. | 23 // SPDY response. |
24 class QuicSpdyClientStream : public QuicDataStream { | 24 class QuicSpdyClientStream : public QuicSpdyStream { |
25 public: | 25 public: |
26 QuicSpdyClientStream(QuicStreamId id, QuicClientSession* session); | 26 QuicSpdyClientStream(QuicStreamId id, QuicClientSession* session); |
27 ~QuicSpdyClientStream() override; | 27 ~QuicSpdyClientStream() override; |
28 | 28 |
29 // Override the base class to close the write side as soon as we get a | 29 // Override the base class to close the write side as soon as we get a |
30 // response. | 30 // response. |
31 // SPDY/HTTP does not support bidirectional streaming. | 31 // SPDY/HTTP does not support bidirectional streaming. |
32 void OnStreamFrame(const QuicStreamFrame& frame) override; | 32 void OnStreamFrame(const QuicStreamFrame& frame) override; |
33 | 33 |
34 // Override the base class to store the size of the headers. | 34 // Override the base class to store the size of the headers. |
(...skipping 23 matching lines...) Expand all Loading... |
58 const SpdyHeaderBlock& headers() { return response_headers_; } | 58 const SpdyHeaderBlock& headers() { return response_headers_; } |
59 | 59 |
60 size_t header_bytes_read() const { return header_bytes_read_; } | 60 size_t header_bytes_read() const { return header_bytes_read_; } |
61 | 61 |
62 size_t header_bytes_written() const { return header_bytes_written_; } | 62 size_t header_bytes_written() const { return header_bytes_written_; } |
63 | 63 |
64 int response_code() const { return response_code_; } | 64 int response_code() const { return response_code_; } |
65 | 65 |
66 // While the server's set_priority shouldn't be called externally, the creator | 66 // While the server's set_priority shouldn't be called externally, the creator |
67 // of client-side streams should be able to set the priority. | 67 // of client-side streams should be able to set the priority. |
68 using QuicDataStream::set_priority; | 68 using QuicSpdyStream::set_priority; |
69 | 69 |
70 void set_allow_bidirectional_data(bool value) { | 70 void set_allow_bidirectional_data(bool value) { |
71 allow_bidirectional_data_ = value; | 71 allow_bidirectional_data_ = value; |
72 } | 72 } |
73 | 73 |
74 bool allow_bidirectional_data() const { return allow_bidirectional_data_; } | 74 bool allow_bidirectional_data() const { return allow_bidirectional_data_; } |
75 | 75 |
76 private: | 76 private: |
77 bool ParseResponseHeaders(const char* data, uint32 data_len); | 77 bool ParseResponseHeaders(const char* data, uint32 data_len); |
78 | 78 |
79 // The parsed headers received from the server. | 79 // The parsed headers received from the server. |
80 SpdyHeaderBlock response_headers_; | 80 SpdyHeaderBlock response_headers_; |
81 // The parsed content-length, or -1 if none is specified. | 81 // The parsed content-length, or -1 if none is specified. |
82 int content_length_; | 82 int content_length_; |
83 int response_code_; | 83 int response_code_; |
84 std::string data_; | 84 std::string data_; |
85 size_t header_bytes_read_; | 85 size_t header_bytes_read_; |
86 size_t header_bytes_written_; | 86 size_t header_bytes_written_; |
87 // When true allows the sending of a request to continue while the response is | 87 // When true allows the sending of a request to continue while the response is |
88 // arriving. | 88 // arriving. |
89 bool allow_bidirectional_data_; | 89 bool allow_bidirectional_data_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(QuicSpdyClientStream); | 91 DISALLOW_COPY_AND_ASSIGN(QuicSpdyClientStream); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace tools | 94 } // namespace tools |
95 } // namespace net | 95 } // namespace net |
96 | 96 |
97 #endif // NET_TOOLS_QUIC_QUIC_SPDY_CLIENT_STREAM_H_ | 97 #endif // NET_TOOLS_QUIC_QUIC_SPDY_CLIENT_STREAM_H_ |
OLD | NEW |