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_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
442 headers_bytes_sent_ += frame_len; | 442 headers_bytes_sent_ += frame_len; |
443 | 443 |
444 request_headers_.clear(); | 444 request_headers_.clear(); |
445 return static_cast<int>(frame_len); | 445 return static_cast<int>(frame_len); |
446 } | 446 } |
447 | 447 |
448 int QuicHttpStream::DoSendHeadersComplete(int rv) { | 448 int QuicHttpStream::DoSendHeadersComplete(int rv) { |
449 if (rv < 0) | 449 if (rv < 0) |
450 return rv; | 450 return rv; |
451 | 451 |
452 if (!stream_) { | |
453 // If the stream is already closed, don't request the body. | |
Ryan Hamilton
2016/01/15 05:02:34
nit: I'd move this above the if and remove the {}s
ramant (doing other things)
2016/01/15 18:03:05
Done.
| |
454 return response_status_; | |
455 } | |
456 | |
452 next_state_ = request_body_stream_ ? STATE_READ_REQUEST_BODY : STATE_OPEN; | 457 next_state_ = request_body_stream_ ? STATE_READ_REQUEST_BODY : STATE_OPEN; |
453 | 458 |
454 return OK; | 459 return OK; |
455 } | 460 } |
456 | 461 |
457 int QuicHttpStream::DoReadRequestBody() { | 462 int QuicHttpStream::DoReadRequestBody() { |
458 next_state_ = STATE_READ_REQUEST_BODY_COMPLETE; | 463 next_state_ = STATE_READ_REQUEST_BODY_COMPLETE; |
459 return request_body_stream_->Read( | 464 return request_body_stream_->Read( |
460 raw_request_body_buf_.get(), raw_request_body_buf_->size(), | 465 raw_request_body_buf_.get(), raw_request_body_buf_->size(), |
461 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); | 466 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 560 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
556 stream_ = nullptr; | 561 stream_ = nullptr; |
557 | 562 |
558 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 563 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
559 // read. | 564 // read. |
560 if (request_body_stream_) | 565 if (request_body_stream_) |
561 request_body_stream_->Reset(); | 566 request_body_stream_->Reset(); |
562 } | 567 } |
563 | 568 |
564 } // namespace net | 569 } // namespace net |
OLD | NEW |