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 #include "net/quic/core/quic_spdy_stream.h" | 5 #include "net/quic/core/quic_spdy_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (!headers_decompressed_) { | 198 if (!headers_decompressed_) { |
199 OnInitialHeadersComplete(fin, frame_len); | 199 OnInitialHeadersComplete(fin, frame_len); |
200 } else { | 200 } else { |
201 OnTrailingHeadersComplete(fin, frame_len); | 201 OnTrailingHeadersComplete(fin, frame_len); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 void QuicSpdyStream::OnStreamHeaderList(bool fin, | 205 void QuicSpdyStream::OnStreamHeaderList(bool fin, |
206 size_t frame_len, | 206 size_t frame_len, |
207 const QuicHeaderList& header_list) { | 207 const QuicHeaderList& header_list) { |
| 208 // The headers list avoid infinite buffering by clearing the headers list |
| 209 // if the current headers are too large. So if the list is empty here |
| 210 // then the headers list must have been too large, and the stream should |
| 211 // be reset. |
| 212 if (FLAGS_quic_limit_uncompressed_headers && header_list.empty()) { |
| 213 OnHeadersTooLarge(); |
| 214 if (IsDoneReading()) { |
| 215 return; |
| 216 } |
| 217 } |
208 if (!headers_decompressed_) { | 218 if (!headers_decompressed_) { |
209 OnInitialHeadersComplete(fin, frame_len, header_list); | 219 OnInitialHeadersComplete(fin, frame_len, header_list); |
210 } else { | 220 } else { |
211 OnTrailingHeadersComplete(fin, frame_len, header_list); | 221 OnTrailingHeadersComplete(fin, frame_len, header_list); |
212 } | 222 } |
213 } | 223 } |
214 | 224 |
| 225 void QuicSpdyStream::OnHeadersTooLarge() { |
| 226 Reset(QUIC_HEADERS_TOO_LARGE); |
| 227 } |
| 228 |
215 void QuicSpdyStream::OnInitialHeadersComplete(bool fin, size_t /*frame_len*/) { | 229 void QuicSpdyStream::OnInitialHeadersComplete(bool fin, size_t /*frame_len*/) { |
216 headers_decompressed_ = true; | 230 headers_decompressed_ = true; |
217 if (fin) { | 231 if (fin) { |
218 OnStreamFrame(QuicStreamFrame(id(), fin, 0, StringPiece())); | 232 OnStreamFrame(QuicStreamFrame(id(), fin, 0, StringPiece())); |
219 } | 233 } |
220 if (FinishedReadingHeaders()) { | 234 if (FinishedReadingHeaders()) { |
221 sequencer()->SetUnblocked(); | 235 sequencer()->SetUnblocked(); |
222 } | 236 } |
223 } | 237 } |
224 | 238 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 if (spdy_session_->headers_stream() != nullptr && | 432 if (spdy_session_->headers_stream() != nullptr && |
419 spdy_session_->force_hol_blocking()) { | 433 spdy_session_->force_hol_blocking()) { |
420 return spdy_session_->headers_stream()->WritevStreamData( | 434 return spdy_session_->headers_stream()->WritevStreamData( |
421 id(), iov, offset, fin, ack_notifier_delegate); | 435 id(), iov, offset, fin, ack_notifier_delegate); |
422 } | 436 } |
423 return ReliableQuicStream::WritevDataInner(iov, offset, fin, | 437 return ReliableQuicStream::WritevDataInner(iov, offset, fin, |
424 ack_notifier_delegate); | 438 ack_notifier_delegate); |
425 } | 439 } |
426 | 440 |
427 } // namespace net | 441 } // namespace net |
OLD | NEW |