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/chromium/quic_http_stream.h" | 5 #include "net/quic/chromium/quic_http_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
17 #include "net/http/http_util.h" | 17 #include "net/http/http_util.h" |
18 #include "net/log/net_log_event_type.h" | 18 #include "net/log/net_log_event_type.h" |
19 #include "net/log/net_log_source.h" | 19 #include "net/log/net_log_source.h" |
20 #include "net/quic/chromium/quic_http_utils.h" | 20 #include "net/quic/chromium/quic_http_utils.h" |
21 #include "net/quic/core/quic_client_promised_info.h" | 21 #include "net/quic/core/quic_client_promised_info.h" |
22 #include "net/quic/core/quic_stream_sequencer.h" | 22 #include "net/quic/core/quic_stream_sequencer.h" |
23 #include "net/quic/core/quic_utils.h" | 23 #include "net/quic/core/quic_utils.h" |
24 #include "net/quic/core/spdy_utils.h" | 24 #include "net/quic/core/spdy_utils.h" |
| 25 #include "net/quic/platform/api/quic_string_piece.h" |
25 #include "net/spdy/spdy_frame_builder.h" | 26 #include "net/spdy/spdy_frame_builder.h" |
26 #include "net/spdy/spdy_framer.h" | 27 #include "net/spdy/spdy_framer.h" |
27 #include "net/spdy/spdy_http_utils.h" | 28 #include "net/spdy/spdy_http_utils.h" |
28 #include "net/ssl/ssl_info.h" | 29 #include "net/ssl/ssl_info.h" |
29 | 30 |
30 namespace net { | 31 namespace net { |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 std::unique_ptr<base::Value> NetLogQuicPushStreamCallback( | 35 std::unique_ptr<base::Value> NetLogQuicPushStreamCallback( |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 int QuicHttpStream::DoSendBody() { | 732 int QuicHttpStream::DoSendBody() { |
732 if (!stream_) | 733 if (!stream_) |
733 return ERR_UNEXPECTED; | 734 return ERR_UNEXPECTED; |
734 | 735 |
735 CHECK(request_body_stream_); | 736 CHECK(request_body_stream_); |
736 CHECK(request_body_buf_.get()); | 737 CHECK(request_body_buf_.get()); |
737 const bool eof = request_body_stream_->IsEOF(); | 738 const bool eof = request_body_stream_->IsEOF(); |
738 int len = request_body_buf_->BytesRemaining(); | 739 int len = request_body_buf_->BytesRemaining(); |
739 if (len > 0 || eof) { | 740 if (len > 0 || eof) { |
740 next_state_ = STATE_SEND_BODY_COMPLETE; | 741 next_state_ = STATE_SEND_BODY_COMPLETE; |
741 base::StringPiece data(request_body_buf_->data(), len); | 742 QuicStringPiece data(request_body_buf_->data(), len); |
742 return stream_->WriteStreamData( | 743 return stream_->WriteStreamData( |
743 data, eof, | 744 data, eof, |
744 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); | 745 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); |
745 } | 746 } |
746 | 747 |
747 next_state_ = STATE_OPEN; | 748 next_state_ = STATE_OPEN; |
748 return OK; | 749 return OK; |
749 } | 750 } |
750 | 751 |
751 int QuicHttpStream::DoSendBodyComplete(int rv) { | 752 int QuicHttpStream::DoSendBodyComplete(int rv) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 closed_is_first_stream_ = stream_->IsFirstStream(); | 825 closed_is_first_stream_ = stream_->IsFirstStream(); |
825 stream_ = nullptr; | 826 stream_ = nullptr; |
826 | 827 |
827 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 828 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
828 // read. | 829 // read. |
829 if (request_body_stream_) | 830 if (request_body_stream_) |
830 request_body_stream_->Reset(); | 831 request_body_stream_->Reset(); |
831 } | 832 } |
832 | 833 |
833 } // namespace net | 834 } // namespace net |
OLD | NEW |