| 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_chromium_client_stream.h" | 5 #include "net/quic/quic_chromium_client_stream.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 headers_len, &headers)) { | 102 headers_len, &headers)) { |
| 103 DLOG(WARNING) << "Invalid headers"; | 103 DLOG(WARNING) << "Invalid headers"; |
| 104 Reset(QUIC_BAD_APPLICATION_PAYLOAD); | 104 Reset(QUIC_BAD_APPLICATION_PAYLOAD); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 MarkHeadersConsumed(headers_len); | 107 MarkHeadersConsumed(headers_len); |
| 108 | 108 |
| 109 session_->HandlePromised(id(), promised_id, headers); | 109 session_->HandlePromised(id(), promised_id, headers); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void QuicChromiumClientStream::OnPromiseHeaderList( |
| 113 QuicStreamId promised_id, |
| 114 size_t frame_len, |
| 115 const QuicHeaderList& header_list) { |
| 116 SpdyHeaderBlock promise_headers; |
| 117 int64_t content_length = -1; |
| 118 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &content_length, |
| 119 &promise_headers)) { |
| 120 DLOG(ERROR) << "Failed to parse header list: " << header_list.DebugString(); |
| 121 ConsumeHeaderList(); |
| 122 Reset(QUIC_BAD_APPLICATION_PAYLOAD); |
| 123 return; |
| 124 } |
| 125 ConsumeHeaderList(); |
| 126 |
| 127 session_->HandlePromised(id(), promised_id, promise_headers); |
| 128 } |
| 129 |
| 112 void QuicChromiumClientStream::OnDataAvailable() { | 130 void QuicChromiumClientStream::OnDataAvailable() { |
| 113 if (!FinishedReadingHeaders() || !headers_delivered_) { | 131 if (!FinishedReadingHeaders() || !headers_delivered_) { |
| 114 // Buffer the data in the sequencer until the headers have been read. | 132 // Buffer the data in the sequencer until the headers have been read. |
| 115 return; | 133 return; |
| 116 } | 134 } |
| 117 | 135 |
| 118 // The delegate will read the data via a posted task, and | 136 // The delegate will read the data via a posted task, and |
| 119 // will be able to, potentially, read all data which has queued up. | 137 // will be able to, potentially, read all data which has queued up. |
| 120 NotifyDelegateOfDataAvailableLater(); | 138 NotifyDelegateOfDataAvailableLater(); |
| 121 } | 139 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } else { | 309 } else { |
| 292 delegate_tasks_.push_back(closure); | 310 delegate_tasks_.push_back(closure); |
| 293 } | 311 } |
| 294 } | 312 } |
| 295 | 313 |
| 296 void QuicChromiumClientStream::DisableConnectionMigration() { | 314 void QuicChromiumClientStream::DisableConnectionMigration() { |
| 297 can_migrate_ = false; | 315 can_migrate_ = false; |
| 298 } | 316 } |
| 299 | 317 |
| 300 } // namespace net | 318 } // namespace net |
| OLD | NEW |