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

Side by Side Diff: net/tools/quic/quic_spdy_client_stream.cc

Issue 2100213002: Make QuicSpdyStream::ParseHeaderStatusCode() inparam const. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/tools/quic/quic_simple_server_stream.cc ('k') | no next file » | 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/tools/quic/quic_spdy_client_stream.h" 5 #include "net/tools/quic/quic_spdy_client_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/quic/quic_alarm.h" 10 #include "net/quic/quic_alarm.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 DCHECK(headers_decompressed()); 48 DCHECK(headers_decompressed());
49 header_bytes_read_ += frame_len; 49 header_bytes_read_ += frame_len;
50 if (!SpdyUtils::ParseHeaders(decompressed_headers().data(), 50 if (!SpdyUtils::ParseHeaders(decompressed_headers().data(),
51 decompressed_headers().length(), 51 decompressed_headers().length(),
52 &content_length_, &response_headers_)) { 52 &content_length_, &response_headers_)) {
53 DLOG(ERROR) << "Failed to parse headers: " << decompressed_headers(); 53 DLOG(ERROR) << "Failed to parse headers: " << decompressed_headers();
54 Reset(QUIC_BAD_APPLICATION_PAYLOAD); 54 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
55 return; 55 return;
56 } 56 }
57 57
58 if (!ParseHeaderStatusCode(&response_headers_, &response_code_)) { 58 if (!ParseHeaderStatusCode(response_headers_, &response_code_)) {
59 DLOG(ERROR) << "Received invalid response code: " 59 DLOG(ERROR) << "Received invalid response code: "
60 << response_headers_[":status"].as_string(); 60 << response_headers_[":status"].as_string();
61 Reset(QUIC_BAD_APPLICATION_PAYLOAD); 61 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
62 return; 62 return;
63 } 63 }
64 64
65 MarkHeadersConsumed(decompressed_headers().length()); 65 MarkHeadersConsumed(decompressed_headers().length());
66 DVLOG(1) << "headers complete for stream " << id(); 66 DVLOG(1) << "headers complete for stream " << id();
67 67
68 session_->OnInitialHeadersComplete(id(), response_headers_); 68 session_->OnInitialHeadersComplete(id(), response_headers_);
69 } 69 }
70 70
71 void QuicSpdyClientStream::OnInitialHeadersComplete( 71 void QuicSpdyClientStream::OnInitialHeadersComplete(
72 bool fin, 72 bool fin,
73 size_t frame_len, 73 size_t frame_len,
74 const QuicHeaderList& header_list) { 74 const QuicHeaderList& header_list) {
75 QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list); 75 QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list);
76 76
77 DCHECK(headers_decompressed()); 77 DCHECK(headers_decompressed());
78 header_bytes_read_ += frame_len; 78 header_bytes_read_ += frame_len;
79 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &content_length_, 79 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &content_length_,
80 &response_headers_)) { 80 &response_headers_)) {
81 DLOG(ERROR) << "Failed to parse header list: " << header_list.DebugString(); 81 DLOG(ERROR) << "Failed to parse header list: " << header_list.DebugString();
82 Reset(QUIC_BAD_APPLICATION_PAYLOAD); 82 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
83 return; 83 return;
84 } 84 }
85 85
86 if (!ParseHeaderStatusCode(&response_headers_, &response_code_)) { 86 if (!ParseHeaderStatusCode(response_headers_, &response_code_)) {
87 DLOG(ERROR) << "Received invalid response code: " 87 DLOG(ERROR) << "Received invalid response code: "
88 << response_headers_[":status"].as_string(); 88 << response_headers_[":status"].as_string();
89 Reset(QUIC_BAD_APPLICATION_PAYLOAD); 89 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
90 return; 90 return;
91 } 91 }
92 92
93 ConsumeHeaderList(); 93 ConsumeHeaderList();
94 DVLOG(1) << "headers complete for stream " << id(); 94 DVLOG(1) << "headers complete for stream " << id();
95 95
96 session_->OnInitialHeadersComplete(id(), response_headers_); 96 session_->OnInitialHeadersComplete(id(), response_headers_);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 bytes_sent += header_bytes_written_; 189 bytes_sent += header_bytes_written_;
190 190
191 if (!body.empty()) { 191 if (!body.empty()) {
192 WriteOrBufferData(body, fin, nullptr); 192 WriteOrBufferData(body, fin, nullptr);
193 } 193 }
194 194
195 return bytes_sent; 195 return bytes_sent;
196 } 196 }
197 197
198 } // namespace net 198 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_server_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698