Chromium Code Reviews| 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 <utility> | |
| 8 | |
| 7 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 8 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 10 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 11 #include "net/base/load_flags.h" | 13 #include "net/base/load_flags.h" |
| 12 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 13 #include "net/http/http_response_headers.h" | 15 #include "net/http/http_response_headers.h" |
| 14 #include "net/http/http_util.h" | 16 #include "net/http/http_util.h" |
| 15 #include "net/quic/quic_client_promised_info.h" | 17 #include "net/quic/quic_client_promised_info.h" |
| 16 #include "net/quic/quic_http_utils.h" | 18 #include "net/quic/quic_http_utils.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 671 return ERR_UNEXPECTED; | 673 return ERR_UNEXPECTED; |
| 672 | 674 |
| 673 // Log the actual request with the URL Request's net log. | 675 // Log the actual request with the URL Request's net log. |
| 674 stream_net_log_.AddEvent( | 676 stream_net_log_.AddEvent( |
| 675 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS, | 677 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS, |
| 676 base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_, | 678 base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_, |
| 677 priority_)); | 679 priority_)); |
| 678 bool has_upload_data = request_body_stream_ != nullptr; | 680 bool has_upload_data = request_body_stream_ != nullptr; |
| 679 | 681 |
| 680 next_state_ = STATE_SEND_HEADERS_COMPLETE; | 682 next_state_ = STATE_SEND_HEADERS_COMPLETE; |
| 681 size_t frame_len = | 683 size_t frame_len = stream_->WriteHeaders(std::move(request_headers_), |
| 682 stream_->WriteHeaders(request_headers_, !has_upload_data, nullptr); | 684 !has_upload_data, nullptr); |
| 683 headers_bytes_sent_ += frame_len; | 685 headers_bytes_sent_ += frame_len; |
| 684 | 686 |
| 685 request_headers_.clear(); | 687 request_headers_ = SpdyHeaderBlock(); |
|
Ryan Hamilton
2016/06/23 18:23:18
Doesn't move do the equivalent of clear()? maybe n
Bence
2016/06/23 23:36:16
I believe the convention is that the moved-from ob
Ryan Hamilton
2016/06/24 00:24:07
Ah! Right. So clear() in this case was to ensure t
Bence
2016/06/24 11:01:42
Done.
| |
| 686 return static_cast<int>(frame_len); | 688 return static_cast<int>(frame_len); |
| 687 } | 689 } |
| 688 | 690 |
| 689 int QuicHttpStream::DoSendHeadersComplete(int rv) { | 691 int QuicHttpStream::DoSendHeadersComplete(int rv) { |
| 690 if (rv < 0) | 692 if (rv < 0) |
| 691 return rv; | 693 return rv; |
| 692 | 694 |
| 693 // If the stream is already closed, don't read the request the body. | 695 // If the stream is already closed, don't read the request the body. |
| 694 if (!stream_) | 696 if (!stream_) |
| 695 return response_status_; | 697 return response_status_; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 817 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 819 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
| 818 stream_ = nullptr; | 820 stream_ = nullptr; |
| 819 | 821 |
| 820 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 822 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
| 821 // read. | 823 // read. |
| 822 if (request_body_stream_) | 824 if (request_body_stream_) |
| 823 request_body_stream_->Reset(); | 825 request_body_stream_->Reset(); |
| 824 } | 826 } |
| 825 | 827 |
| 826 } // namespace net | 828 } // namespace net |
| OLD | NEW |