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 #include "net/quic/quic_data_stream.h" | 5 #include "net/quic/quic_data_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/quic_session.h" | 8 #include "net/quic/quic_session.h" |
9 #include "net/quic/quic_spdy_decompressor.h" | 9 #include "net/quic/quic_spdy_decompressor.h" |
10 #include "net/spdy/write_blocked_list.h" | 10 #include "net/spdy/write_blocked_list.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 if (!priority_parsed_ && session()->connection()->is_server()) { | 302 if (!priority_parsed_ && session()->connection()->is_server()) { |
303 QuicPriority temporary_priority = priority_; | 303 QuicPriority temporary_priority = priority_; |
304 total_bytes_parsed = StripUint32( | 304 total_bytes_parsed = StripUint32( |
305 data, data_len, &headers_id_and_priority_buffer_, &temporary_priority); | 305 data, data_len, &headers_id_and_priority_buffer_, &temporary_priority); |
306 if (total_bytes_parsed > 0 && headers_id_and_priority_buffer_.size() == 0) { | 306 if (total_bytes_parsed > 0 && headers_id_and_priority_buffer_.size() == 0) { |
307 priority_parsed_ = true; | 307 priority_parsed_ = true; |
308 | 308 |
309 // Spdy priorities are inverted, so the highest numerical value is the | 309 // Spdy priorities are inverted, so the highest numerical value is the |
310 // lowest legal priority. | 310 // lowest legal priority. |
311 if (temporary_priority > static_cast<QuicPriority>(kLowestPriority)) { | 311 if (temporary_priority > QuicUtils::LowestPriority()) { |
312 session()->connection()->SendConnectionClose(QUIC_INVALID_PRIORITY); | 312 session()->connection()->SendConnectionClose(QUIC_INVALID_PRIORITY); |
313 return 0; | 313 return 0; |
314 } | 314 } |
315 priority_ = temporary_priority; | 315 priority_ = temporary_priority; |
316 } | 316 } |
317 data += total_bytes_parsed; | 317 data += total_bytes_parsed; |
318 data_len -= total_bytes_parsed; | 318 data_len -= total_bytes_parsed; |
319 } | 319 } |
320 if (data_len > 0 && headers_id_ == 0u) { | 320 if (data_len > 0 && headers_id_ == 0u) { |
321 // The headers ID has not yet been read. Strip it from the beginning of | 321 // The headers ID has not yet been read. Strip it from the beginning of |
322 // the data stream. | 322 // the data stream. |
323 total_bytes_parsed += StripUint32( | 323 total_bytes_parsed += StripUint32( |
324 data, data_len, &headers_id_and_priority_buffer_, &headers_id_); | 324 data, data_len, &headers_id_and_priority_buffer_, &headers_id_); |
325 } | 325 } |
326 return total_bytes_parsed; | 326 return total_bytes_parsed; |
327 } | 327 } |
328 | 328 |
329 bool QuicDataStream::FinishedReadingHeaders() { | 329 bool QuicDataStream::FinishedReadingHeaders() { |
330 return headers_decompressed_ && decompressed_headers_.empty(); | 330 return headers_decompressed_ && decompressed_headers_.empty(); |
331 } | 331 } |
332 | 332 |
333 } // namespace net | 333 } // namespace net |
OLD | NEW |