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

Side by Side Diff: net/spdy/bidirectional_stream_spdy_impl.cc

Issue 2526003002: Disallow multiple HEADERS frames on pushed streams. (Closed)
Patch Set: Rename enum, enum entry, and member. Created 4 years 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/spdy/bidirectional_stream_spdy_impl.h ('k') | net/spdy/spdy_http_stream.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/spdy/bidirectional_stream_spdy_impl.h" 5 #include "net/spdy/bidirectional_stream_spdy_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 // If |stream_| isn't created or has ID 0, return false. This is to match 205 // If |stream_| isn't created or has ID 0, return false. This is to match
206 // the implementation in SpdyHttpStream. 206 // the implementation in SpdyHttpStream.
207 if (!stream_ || stream_->stream_id() == 0) 207 if (!stream_ || stream_->stream_id() == 0)
208 return false; 208 return false;
209 209
210 return stream_->GetLoadTimingInfo(load_timing_info); 210 return stream_->GetLoadTimingInfo(load_timing_info);
211 } 211 }
212 212
213 void BidirectionalStreamSpdyImpl::OnRequestHeadersSent() { 213 void BidirectionalStreamSpdyImpl::OnHeadersSent() {
214 DCHECK(stream_); 214 DCHECK(stream_);
215 215
216 negotiated_protocol_ = kProtoHTTP2; 216 negotiated_protocol_ = kProtoHTTP2;
217 if (delegate_) 217 if (delegate_)
218 delegate_->OnStreamReady(/*request_headers_sent=*/true); 218 delegate_->OnStreamReady(/*request_headers_sent=*/true);
219 } 219 }
220 220
221 SpdyResponseHeadersStatus BidirectionalStreamSpdyImpl::OnResponseHeadersUpdated( 221 void BidirectionalStreamSpdyImpl::OnHeadersReceived(
222 const SpdyHeaderBlock& response_headers) { 222 const SpdyHeaderBlock& response_headers) {
223 DCHECK(stream_); 223 DCHECK(stream_);
224 224
225 if (delegate_) 225 if (delegate_)
226 delegate_->OnHeadersReceived(response_headers); 226 delegate_->OnHeadersReceived(response_headers);
227
228 return RESPONSE_HEADERS_ARE_COMPLETE;
229 } 227 }
230 228
231 void BidirectionalStreamSpdyImpl::OnDataReceived( 229 void BidirectionalStreamSpdyImpl::OnDataReceived(
232 std::unique_ptr<SpdyBuffer> buffer) { 230 std::unique_ptr<SpdyBuffer> buffer) {
233 DCHECK(stream_); 231 DCHECK(stream_);
234 DCHECK(!stream_closed_); 232 DCHECK(!stream_closed_);
235 233
236 // If |buffer| is null, BidirectionalStreamSpdyImpl::OnClose will be invoked 234 // If |buffer| is null, BidirectionalStreamSpdyImpl::OnClose will be invoked
237 // by SpdyStream to indicate the end of stream. 235 // by SpdyStream to indicate the end of stream.
238 if (!buffer) 236 if (!buffer)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 : MORE_DATA_TO_SEND); 308 : MORE_DATA_TO_SEND);
311 } 309 }
312 310
313 void BidirectionalStreamSpdyImpl::OnStreamInitialized(int rv) { 311 void BidirectionalStreamSpdyImpl::OnStreamInitialized(int rv) {
314 DCHECK_NE(ERR_IO_PENDING, rv); 312 DCHECK_NE(ERR_IO_PENDING, rv);
315 if (rv == OK) { 313 if (rv == OK) {
316 stream_ = stream_request_.ReleaseStream(); 314 stream_ = stream_request_.ReleaseStream();
317 stream_->SetDelegate(this); 315 stream_->SetDelegate(this);
318 rv = SendRequestHeadersHelper(); 316 rv = SendRequestHeadersHelper();
319 if (rv == OK) { 317 if (rv == OK) {
320 OnRequestHeadersSent(); 318 OnHeadersSent();
321 return; 319 return;
322 } else if (rv == ERR_IO_PENDING) { 320 } else if (rv == ERR_IO_PENDING) {
323 return; 321 return;
324 } 322 }
325 } 323 }
326 NotifyError(rv); 324 NotifyError(rv);
327 } 325 }
328 326
329 void BidirectionalStreamSpdyImpl::NotifyError(int rv) { 327 void BidirectionalStreamSpdyImpl::NotifyError(int rv) {
330 ResetStream(); 328 ResetStream();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 return true; 408 return true;
411 } 409 }
412 LOG(ERROR) << "Trying to send data after stream has been destroyed."; 410 LOG(ERROR) << "Trying to send data after stream has been destroyed.";
413 base::ThreadTaskRunnerHandle::Get()->PostTask( 411 base::ThreadTaskRunnerHandle::Get()->PostTask(
414 FROM_HERE, base::Bind(&BidirectionalStreamSpdyImpl::NotifyError, 412 FROM_HERE, base::Bind(&BidirectionalStreamSpdyImpl::NotifyError,
415 weak_factory_.GetWeakPtr(), ERR_UNEXPECTED)); 413 weak_factory_.GetWeakPtr(), ERR_UNEXPECTED));
416 return true; 414 return true;
417 } 415 }
418 416
419 } // namespace net 417 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/bidirectional_stream_spdy_impl.h ('k') | net/spdy/spdy_http_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698