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

Side by Side Diff: net/quic/quic_http_stream.cc

Issue 1824403002: Add logging for headers sent and received in BidirectionalStreamQuicImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 4 years, 9 months 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/quic/quic_chromium_client_stream.cc ('k') | net/quic/quic_http_stream_test.cc » ('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 (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/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 630
631 int QuicHttpStream::DoSendHeaders() { 631 int QuicHttpStream::DoSendHeaders() {
632 if (!stream_) 632 if (!stream_)
633 return ERR_UNEXPECTED; 633 return ERR_UNEXPECTED;
634 634
635 // Log the actual request with the URL Request's net log. 635 // Log the actual request with the URL Request's net log.
636 stream_net_log_.AddEvent( 636 stream_net_log_.AddEvent(
637 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS, 637 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS,
638 base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_, 638 base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_,
639 priority_)); 639 priority_));
640 // Also log to the QuicSession's net log.
641 stream_->net_log().AddEvent(
642 NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS,
643 base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_,
644 priority_));
645
646 bool has_upload_data = request_body_stream_ != nullptr; 640 bool has_upload_data = request_body_stream_ != nullptr;
647 641
648 next_state_ = STATE_SEND_HEADERS_COMPLETE; 642 next_state_ = STATE_SEND_HEADERS_COMPLETE;
649 size_t frame_len = 643 size_t frame_len =
650 stream_->WriteHeaders(request_headers_, !has_upload_data, nullptr); 644 stream_->WriteHeaders(request_headers_, !has_upload_data, nullptr);
651 headers_bytes_sent_ += frame_len; 645 headers_bytes_sent_ += frame_len;
652 646
653 request_headers_.clear(); 647 request_headers_.clear();
654 return static_cast<int>(frame_len); 648 return static_cast<int>(frame_len);
655 } 649 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 if (!request_body_stream_->IsEOF()) { 720 if (!request_body_stream_->IsEOF()) {
727 next_state_ = STATE_READ_REQUEST_BODY; 721 next_state_ = STATE_READ_REQUEST_BODY;
728 return OK; 722 return OK;
729 } 723 }
730 724
731 next_state_ = STATE_OPEN; 725 next_state_ = STATE_OPEN;
732 return OK; 726 return OK;
733 } 727 }
734 728
735 int QuicHttpStream::ProcessResponseHeaders(const SpdyHeaderBlock& headers) { 729 int QuicHttpStream::ProcessResponseHeaders(const SpdyHeaderBlock& headers) {
736 // The URLRequest logs these headers, so only log to the QuicSession's
737 // net log.
738 stream_->net_log().AddEvent(
739 NetLog::TYPE_QUIC_HTTP_STREAM_READ_RESPONSE_HEADERS,
740 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
741
742 if (!SpdyHeadersToHttpResponse(headers, HTTP2, response_info_)) { 730 if (!SpdyHeadersToHttpResponse(headers, HTTP2, response_info_)) {
743 DLOG(WARNING) << "Invalid headers"; 731 DLOG(WARNING) << "Invalid headers";
744 return ERR_QUIC_PROTOCOL_ERROR; 732 return ERR_QUIC_PROTOCOL_ERROR;
745 } 733 }
746 // Put the peer's IP address and port into the response. 734 // Put the peer's IP address and port into the response.
747 IPEndPoint address = session_->peer_address(); 735 IPEndPoint address = session_->peer_address();
748 response_info_->socket_address = HostPortPair::FromIPEndPoint(address); 736 response_info_->socket_address = HostPortPair::FromIPEndPoint(address);
749 response_info_->connection_info = 737 response_info_->connection_info =
750 HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3; 738 HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3;
751 response_info_->vary_data.Init(*request_info_, 739 response_info_->vary_data.Init(*request_info_,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 775 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
788 stream_ = nullptr; 776 stream_ = nullptr;
789 777
790 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress 778 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress
791 // read. 779 // read.
792 if (request_body_stream_) 780 if (request_body_stream_)
793 request_body_stream_->Reset(); 781 request_body_stream_->Reset();
794 } 782 }
795 783
796 } // namespace net 784 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_stream.cc ('k') | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698