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 the stream is already closed, don't read the request the body. |
| 453 if (!stream_) |
| 454 return response_status_; |
| 455 |
452 next_state_ = request_body_stream_ ? STATE_READ_REQUEST_BODY : STATE_OPEN; | 456 next_state_ = request_body_stream_ ? STATE_READ_REQUEST_BODY : STATE_OPEN; |
453 | 457 |
454 return OK; | 458 return OK; |
455 } | 459 } |
456 | 460 |
457 int QuicHttpStream::DoReadRequestBody() { | 461 int QuicHttpStream::DoReadRequestBody() { |
458 next_state_ = STATE_READ_REQUEST_BODY_COMPLETE; | 462 next_state_ = STATE_READ_REQUEST_BODY_COMPLETE; |
459 return request_body_stream_->Read( | 463 return request_body_stream_->Read( |
460 raw_request_body_buf_.get(), raw_request_body_buf_->size(), | 464 raw_request_body_buf_.get(), raw_request_body_buf_->size(), |
461 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); | 465 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(); | 559 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
556 stream_ = nullptr; | 560 stream_ = nullptr; |
557 | 561 |
558 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 562 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
559 // read. | 563 // read. |
560 if (request_body_stream_) | 564 if (request_body_stream_) |
561 request_body_stream_->Reset(); | 565 request_body_stream_->Reset(); |
562 } | 566 } |
563 | 567 |
564 } // namespace net | 568 } // namespace net |
OLD | NEW |