Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: net/quic/quic_chromium_client_stream.cc

Issue 1997863002: Revert of Avoids the "re-encode HPACK as SPDY3" step. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_chromium_client_stream.h ('k') | net/quic/quic_headers_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return; 53 return;
54 } 54 }
55 MarkHeadersConsumed(headers_len); 55 MarkHeadersConsumed(headers_len);
56 session_->OnInitialHeadersComplete(id(), headers); 56 session_->OnInitialHeadersComplete(id(), headers);
57 57
58 // The delegate will read the headers via a posted task. 58 // The delegate will read the headers via a posted task.
59 NotifyDelegateOfHeadersCompleteLater(headers, frame_len); 59 NotifyDelegateOfHeadersCompleteLater(headers, frame_len);
60 } 60 }
61 } 61 }
62 62
63 void QuicChromiumClientStream::OnInitialHeadersComplete(
64 bool fin,
65 size_t frame_len,
66 const QuicHeaderList& header_list) {
67 QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list);
68
69 SpdyHeaderBlock header_block;
70 int64_t length = -1;
71 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &length, &header_block)) {
72 DLOG(ERROR) << "Failed to parse header list: " << header_list.DebugString();
73 ConsumeHeaderList();
74 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
75 return;
76 }
77
78 ConsumeHeaderList();
79 session_->OnInitialHeadersComplete(id(), header_block);
80
81 // The delegate will read the headers via a posted task.
82 NotifyDelegateOfHeadersCompleteLater(header_block, frame_len);
83 }
84
85 void QuicChromiumClientStream::OnTrailingHeadersComplete(
86 bool fin,
87 size_t frame_len,
88 const QuicHeaderList& header_list) {
89 QuicSpdyStream::OnTrailingHeadersComplete(fin, frame_len, header_list);
90 NotifyDelegateOfHeadersCompleteLater(received_trailers(), frame_len);
91 }
92
93 void QuicChromiumClientStream::OnPromiseHeadersComplete( 63 void QuicChromiumClientStream::OnPromiseHeadersComplete(
94 QuicStreamId promised_id, 64 QuicStreamId promised_id,
95 size_t frame_len) { 65 size_t frame_len) {
96 size_t headers_len = decompressed_headers().length(); 66 size_t headers_len = decompressed_headers().length();
97 SpdyHeaderBlock headers; 67 SpdyHeaderBlock headers;
98 SpdyFramer framer(HTTP2); 68 SpdyFramer framer(HTTP2);
99 if (!framer.ParseHeaderBlockInBuffer(decompressed_headers().data(), 69 if (!framer.ParseHeaderBlockInBuffer(decompressed_headers().data(),
100 headers_len, &headers)) { 70 headers_len, &headers)) {
101 DLOG(WARNING) << "Invalid headers"; 71 DLOG(WARNING) << "Invalid headers";
102 Reset(QUIC_BAD_APPLICATION_PAYLOAD); 72 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 215 }
246 216
247 void QuicChromiumClientStream::NotifyDelegateOfHeadersComplete( 217 void QuicChromiumClientStream::NotifyDelegateOfHeadersComplete(
248 SpdyHeaderBlock headers, 218 SpdyHeaderBlock headers,
249 size_t frame_len) { 219 size_t frame_len) {
250 if (!delegate_) 220 if (!delegate_)
251 return; 221 return;
252 // Only mark trailers consumed when we are about to notify delegate. 222 // Only mark trailers consumed when we are about to notify delegate.
253 if (headers_delivered_) { 223 if (headers_delivered_) {
254 MarkTrailersConsumed(decompressed_trailers().length()); 224 MarkTrailersConsumed(decompressed_trailers().length());
255 MarkTrailersDelivered();
256 net_log_.AddEvent( 225 net_log_.AddEvent(
257 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS, 226 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS,
258 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); 227 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
259 } else { 228 } else {
260 headers_delivered_ = true; 229 headers_delivered_ = true;
261 net_log_.AddEvent( 230 net_log_.AddEvent(
262 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS, 231 NetLog::TYPE_QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS,
263 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); 232 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
264 } 233 }
265 234
(...skipping 17 matching lines...) Expand all
283 } else { 252 } else {
284 delegate_tasks_.push_back(closure); 253 delegate_tasks_.push_back(closure);
285 } 254 }
286 } 255 }
287 256
288 void QuicChromiumClientStream::DisableConnectionMigration() { 257 void QuicChromiumClientStream::DisableConnectionMigration() {
289 can_migrate_ = false; 258 can_migrate_ = false;
290 } 259 }
291 260
292 } // namespace net 261 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_stream.h ('k') | net/quic/quic_headers_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698