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

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

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: fix include 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
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 <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "net/quic/core/quic_bug_tracker.h" 15 #include "net/quic/core/quic_bug_tracker.h"
16 #include "net/quic/core/quic_flags.h" 16 #include "net/quic/core/quic_flags.h"
17 #include "net/quic/core/quic_header_list.h" 17 #include "net/quic/core/quic_header_list.h"
18 #include "net/quic/core/quic_server_session_base.h" 18 #include "net/quic/core/quic_server_session_base.h"
19 #include "net/quic/core/quic_spdy_session.h" 19 #include "net/quic/core/quic_spdy_session.h"
20 #include "net/quic/core/quic_time.h" 20 #include "net/quic/core/quic_time.h"
21 #include "net/quic/platform/api/quic_str_cat.h"
21 #include "net/spdy/spdy_protocol.h" 22 #include "net/spdy/spdy_protocol.h"
22 23
23 using base::StringPiece; 24 using base::StringPiece;
24 using net::SpdyFrameType; 25 using net::SpdyFrameType;
25 using std::string; 26 using std::string;
26 27
27 namespace net { 28 namespace net {
28 29
29 namespace { 30 namespace {
30 31
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 bool end_headers) override { 143 bool end_headers) override {
143 if (end_headers) { 144 if (end_headers) {
144 if (stream_->IsConnected()) { 145 if (stream_->IsConnected()) {
145 stream_->OnHeaderList(header_list_); 146 stream_->OnHeaderList(header_list_);
146 } 147 }
147 header_list_.Clear(); 148 header_list_.Clear();
148 } 149 }
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_enable_server_push_by_default && 182 if (FLAGS_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_send_max_header_list_size) { 200 if (FLAGS_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_respect_http2_settings_frame) { 210 if (!FLAGS_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

Powered by Google App Engine
This is Rietveld 408576698