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

Side by Side Diff: net/quic/core/quic_headers_stream.cc

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: sync Created 3 years, 12 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/core/quic_flow_controller_test.cc ('k') | net/quic/core/quic_headers_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/core/quic_headers_stream.h" 5 #include "net/quic/core/quic_headers_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdint> 8 #include <cstdint>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "net/quic/core/quic_bug_tracker.h" 16 #include "net/quic/core/quic_bug_tracker.h"
17 #include "net/quic/core/quic_flags.h" 17 #include "net/quic/core/quic_flags.h"
18 #include "net/quic/core/quic_header_list.h" 18 #include "net/quic/core/quic_header_list.h"
19 #include "net/quic/core/quic_server_session_base.h" 19 #include "net/quic/core/quic_server_session_base.h"
20 #include "net/quic/core/quic_spdy_session.h" 20 #include "net/quic/core/quic_spdy_session.h"
21 #include "net/quic/core/quic_time.h" 21 #include "net/quic/core/quic_time.h"
22 #include "net/quic/platform/api/quic_str_cat.h"
22 #include "net/spdy/spdy_protocol.h" 23 #include "net/spdy/spdy_protocol.h"
23 24
24 using base::StringPiece; 25 using base::StringPiece;
25 using std::string; 26 using std::string;
26 27
27 namespace net { 28 namespace net {
28 29
29 namespace { 30 namespace {
30 31
31 class HeaderTableDebugVisitor : public HpackHeaderTable::DebugVisitorInterface { 32 class HeaderTableDebugVisitor : public HpackHeaderTable::DebugVisitorInterface {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void OnStreamEnd(SpdyStreamId stream_id) override { 143 void OnStreamEnd(SpdyStreamId stream_id) override {
143 // The framer invokes OnStreamEnd after processing a frame that had the fin 144 // The framer invokes OnStreamEnd after processing a frame that had the fin
144 // bit set. 145 // bit set.
145 } 146 }
146 147
147 void OnStreamPadding(SpdyStreamId stream_id, size_t len) override { 148 void OnStreamPadding(SpdyStreamId stream_id, size_t len) override {
148 CloseConnection("SPDY frame padding received."); 149 CloseConnection("SPDY frame padding received.");
149 } 150 }
150 151
151 void OnError(SpdyFramer* framer) override { 152 void OnError(SpdyFramer* framer) override {
152 CloseConnection(base::StringPrintf( 153 CloseConnection(
153 "SPDY framing error: %s", 154 QuicStrCat("SPDY framing error: ",
154 SpdyFramer::ErrorCodeToString(framer->error_code()))); 155 SpdyFramer::ErrorCodeToString(framer->error_code())));
155 } 156 }
156 157
157 void OnDataFrameHeader(SpdyStreamId stream_id, 158 void OnDataFrameHeader(SpdyStreamId stream_id,
158 size_t length, 159 size_t length,
159 bool fin) override { 160 bool fin) override {
160 if (stream_->OnDataFrameHeader(stream_id, length, fin)) { 161 if (stream_->OnDataFrameHeader(stream_id, length, fin)) {
161 return; 162 return;
162 } 163 }
163 CloseConnection("SPDY DATA frame received."); 164 CloseConnection("SPDY DATA frame received.");
164 } 165 }
(...skipping 10 matching lines...) Expand all
175 } 176 }
176 switch (id) { 177 switch (id) {
177 case SETTINGS_HEADER_TABLE_SIZE: 178 case SETTINGS_HEADER_TABLE_SIZE:
178 stream_->UpdateHeaderEncoderTableSize(value); 179 stream_->UpdateHeaderEncoderTableSize(value);
179 break; 180 break;
180 case SETTINGS_ENABLE_PUSH: 181 case SETTINGS_ENABLE_PUSH:
181 if (FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default && 182 if (FLAGS_quic_reloadable_flag_quic_enable_server_push_by_default &&
182 stream_->session()->perspective() == Perspective::IS_SERVER) { 183 stream_->session()->perspective() == Perspective::IS_SERVER) {
183 // See rfc7540, Section 6.5.2. 184 // See rfc7540, Section 6.5.2.
184 if (value > 1) { 185 if (value > 1) {
185 CloseConnection("Invalid value for SETTINGS_ENABLE_PUSH: " + 186 CloseConnection(
186 base::IntToString(value)); 187 QuicStrCat("Invalid value for SETTINGS_ENABLE_PUSH: ", value));
187 return; 188 return;
188 } 189 }
189 stream_->UpdateEnableServerPush(value > 0); 190 stream_->UpdateEnableServerPush(value > 0);
190 break; 191 break;
191 } else { 192 } else {
192 CloseConnection("Unsupported field of HTTP/2 SETTINGS frame: " + 193 CloseConnection(
193 base::IntToString(id)); 194 QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id));
194 } 195 }
195 break; 196 break;
196 // TODO(fayang): Need to support SETTINGS_MAX_HEADER_LIST_SIZE when 197 // TODO(fayang): Need to support SETTINGS_MAX_HEADER_LIST_SIZE when
197 // clients are actually sending it. 198 // clients are actually sending it.
198 case SETTINGS_MAX_HEADER_LIST_SIZE: 199 case SETTINGS_MAX_HEADER_LIST_SIZE:
199 if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) { 200 if (FLAGS_quic_reloadable_flag_quic_send_max_header_list_size) {
200 break; 201 break;
201 } 202 }
202 default: 203 default:
203 CloseConnection("Unsupported field of HTTP/2 SETTINGS frame: " + 204 CloseConnection(
204 base::IntToString(id)); 205 QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id));
205 } 206 }
206 } 207 }
207 208
208 void OnSettingsAck() override { 209 void OnSettingsAck() override {
209 if (!FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame) { 210 if (!FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame) {
210 CloseConnection("SPDY SETTINGS frame received."); 211 CloseConnection("SPDY SETTINGS frame received.");
211 } 212 }
212 } 213 }
213 214
214 void OnSettingsEnd() override { 215 void OnSettingsEnd() override {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 return true; 627 return true;
627 } 628 }
628 frame_len_ -= len; 629 frame_len_ -= len;
629 // Ignore fin_ while there is more data coming, if frame_len_ > 0. 630 // Ignore fin_ while there is more data coming, if frame_len_ > 0.
630 spdy_session_->OnStreamFrameData(stream_id, data, len, 631 spdy_session_->OnStreamFrameData(stream_id, data, len,
631 frame_len_ > 0 ? false : fin_); 632 frame_len_ > 0 ? false : fin_);
632 return true; 633 return true;
633 } 634 }
634 635
635 } // namespace net 636 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_flow_controller_test.cc ('k') | net/quic/core/quic_headers_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698