OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // The base class for streams which deliver data to/from an application. | 5 // The base class for streams which deliver data to/from an application. |
6 // In each direction, the data on such a stream first contains compressed | 6 // In each direction, the data on such a stream first contains compressed |
7 // headers then body data. | 7 // headers then body data. |
8 | 8 |
9 #ifndef NET_QUIC_QUIC_SPDY_STREAM_H_ | 9 #ifndef NET_QUIC_QUIC_SPDY_STREAM_H_ |
10 #define NET_QUIC_QUIC_SPDY_STREAM_H_ | 10 #define NET_QUIC_QUIC_SPDY_STREAM_H_ |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // should be closed; no more data will be sent by the peer. | 93 // should be closed; no more data will be sent by the peer. |
94 virtual void OnStreamHeadersComplete(bool fin, size_t frame_len); | 94 virtual void OnStreamHeadersComplete(bool fin, size_t frame_len); |
95 | 95 |
96 // Called by the session when decompressed headers have been completely | 96 // Called by the session when decompressed headers have been completely |
97 // delivered to this stream. If |fin| is true, then this stream | 97 // delivered to this stream. If |fin| is true, then this stream |
98 // should be closed; no more data will be sent by the peer. | 98 // should be closed; no more data will be sent by the peer. |
99 virtual void OnStreamHeaderList(bool fin, | 99 virtual void OnStreamHeaderList(bool fin, |
100 size_t frame_len, | 100 size_t frame_len, |
101 const QuicHeaderList& header_list); | 101 const QuicHeaderList& header_list); |
102 | 102 |
| 103 // Called when the received headers are too large. By default this will |
| 104 // reset the stream. |
| 105 virtual void OnHeadersTooLarge(); |
| 106 |
103 // Called by the session when decompressed PUSH_PROMISE headers data | 107 // Called by the session when decompressed PUSH_PROMISE headers data |
104 // is received for this stream. | 108 // is received for this stream. |
105 // May be called multiple times, with each call providing additional headers | 109 // May be called multiple times, with each call providing additional headers |
106 // data until OnPromiseHeadersComplete is called. | 110 // data until OnPromiseHeadersComplete is called. |
107 virtual void OnPromiseHeaders(base::StringPiece headers_data); | 111 virtual void OnPromiseHeaders(base::StringPiece headers_data); |
108 | 112 |
109 // Called by the session when decompressed push promise headers have | 113 // Called by the session when decompressed push promise headers have |
110 // been completely delivered to this stream. | 114 // been completely delivered to this stream. |
111 virtual void OnPromiseHeadersComplete(QuicStreamId promised_id, | 115 virtual void OnPromiseHeadersComplete(QuicStreamId promised_id, |
112 size_t frame_len); | 116 size_t frame_len); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void SetPriority(SpdyPriority priority); | 208 void SetPriority(SpdyPriority priority); |
205 | 209 |
206 // Called when owning session is getting deleted to avoid subsequent | 210 // Called when owning session is getting deleted to avoid subsequent |
207 // use of the spdy_session_ member. | 211 // use of the spdy_session_ member. |
208 void ClearSession(); | 212 void ClearSession(); |
209 | 213 |
210 // Returns true if the sequencer has delivered the FIN, and no more body bytes | 214 // Returns true if the sequencer has delivered the FIN, and no more body bytes |
211 // will be available. | 215 // will be available. |
212 bool IsClosed() { return sequencer()->IsClosed(); } | 216 bool IsClosed() { return sequencer()->IsClosed(); } |
213 | 217 |
| 218 void set_allow_bidirectional_data(bool value) { |
| 219 allow_bidirectional_data_ = value; |
| 220 } |
| 221 |
| 222 bool allow_bidirectional_data() const { return allow_bidirectional_data_; } |
| 223 |
214 protected: | 224 protected: |
215 // Called by OnStreamHeadersComplete depending on which type (initial or | 225 // Called by OnStreamHeadersComplete depending on which type (initial or |
216 // trailing) headers are expected next. | 226 // trailing) headers are expected next. |
217 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len); | 227 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len); |
218 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len); | 228 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len); |
219 virtual void OnInitialHeadersComplete(bool fin, | 229 virtual void OnInitialHeadersComplete(bool fin, |
220 size_t frame_len, | 230 size_t frame_len, |
221 const QuicHeaderList& header_list); | 231 const QuicHeaderList& header_list); |
222 virtual void OnTrailingHeadersComplete(bool fin, | 232 virtual void OnTrailingHeadersComplete(bool fin, |
223 size_t frame_len, | 233 size_t frame_len, |
(...skipping 10 matching lines...) Expand all Loading... |
234 QuicAckListenerInterface* ack_notifier_delegate) override; | 244 QuicAckListenerInterface* ack_notifier_delegate) override; |
235 | 245 |
236 private: | 246 private: |
237 friend class test::QuicSpdyStreamPeer; | 247 friend class test::QuicSpdyStreamPeer; |
238 friend class test::ReliableQuicStreamPeer; | 248 friend class test::ReliableQuicStreamPeer; |
239 friend class QuicStreamUtils; | 249 friend class QuicStreamUtils; |
240 | 250 |
241 QuicSpdySession* spdy_session_; | 251 QuicSpdySession* spdy_session_; |
242 | 252 |
243 Visitor* visitor_; | 253 Visitor* visitor_; |
| 254 // If true, allow sending of a request to continue while the response is |
| 255 // arriving. |
| 256 bool allow_bidirectional_data_; |
244 // True if the headers have been completely decompressed. | 257 // True if the headers have been completely decompressed. |
245 bool headers_decompressed_; | 258 bool headers_decompressed_; |
246 // The priority of the stream, once parsed. | 259 // The priority of the stream, once parsed. |
247 SpdyPriority priority_; | 260 SpdyPriority priority_; |
248 // Contains a copy of the decompressed headers until they are consumed | 261 // Contains a copy of the decompressed headers until they are consumed |
249 // via ProcessData or Readv. | 262 // via ProcessData or Readv. |
250 std::string decompressed_headers_; | 263 std::string decompressed_headers_; |
251 // Contains a copy of the decompressed header (name, value) pairs until they | 264 // Contains a copy of the decompressed header (name, value) pairs until they |
252 // are consumed via Readv. | 265 // are consumed via Readv. |
253 QuicHeaderList header_list_; | 266 QuicHeaderList header_list_; |
254 | 267 |
255 // True if the trailers have been completely decompressed. | 268 // True if the trailers have been completely decompressed. |
256 bool trailers_decompressed_; | 269 bool trailers_decompressed_; |
257 // True if the trailers have been consumed. | 270 // True if the trailers have been consumed. |
258 bool trailers_consumed_; | 271 bool trailers_consumed_; |
259 // Contains a copy of the decompressed trailers until they are consumed | 272 // Contains a copy of the decompressed trailers until they are consumed |
260 // via ProcessData or Readv. | 273 // via ProcessData or Readv. |
261 std::string decompressed_trailers_; | 274 std::string decompressed_trailers_; |
262 // The parsed trailers received from the peer. | 275 // The parsed trailers received from the peer. |
263 SpdyHeaderBlock received_trailers_; | 276 SpdyHeaderBlock received_trailers_; |
264 | 277 |
265 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); | 278 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); |
266 }; | 279 }; |
267 | 280 |
268 } // namespace net | 281 } // namespace net |
269 | 282 |
270 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ | 283 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ |
OLD | NEW |