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

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

Issue 2403193003: Landing Recent QUIC changes until 9:41 AM, Oct 10, 2016 UTC-7 (Closed)
Patch Set: git cl format Created 4 years, 2 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 (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/spdy_balsa_utils.h" 5 #include "net/tools/quic/spdy_balsa_utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } else { 260 } else {
261 path = request_uri->path(); 261 path = request_uri->path();
262 if (!request_uri->query().empty()) { 262 if (!request_uri->query().empty()) {
263 path = path + "?" + request_uri->query(); 263 path = path + "?" + request_uri->query();
264 } 264 }
265 host_and_port = request_uri->host(); 265 host_and_port = request_uri->host();
266 scheme = request_uri->scheme(); 266 scheme = request_uri->scheme();
267 } 267 }
268 } 268 }
269 269
270 DCHECK(!scheme.empty()); 270 if (scheme.empty()) {
271 DCHECK(!host_and_port.empty()); 271 if (request_headers.HasHeader("Scheme")) {
272 DCHECK(!path.empty()); 272 request_headers.GetAllOfHeaderAsString("Scheme", &scheme);
273 } else {
274 // Requests must contain a :scheme header, and unless another scheme is
275 // detected, https is assumed.
276 scheme = "https";
277 }
278 }
273 279
274 SpdyHeaderBlock block; 280 SpdyHeaderBlock block;
275 PopulateHttp2RequestHeaderBlock(request_headers, scheme, host_and_port, path, 281 PopulateHttp2RequestHeaderBlock(request_headers, scheme, host_and_port, path,
276 &block); 282 &block);
283
284 // If a "Scheme" header existed in request_headers, it would have been
285 // propagated to |block|.
286 block.erase("scheme");
277 return block; 287 return block;
278 } 288 }
279 289
280 // static 290 // static
281 SpdyHeaderBlock SpdyBalsaUtils::ResponseHeadersToSpdyHeaders( 291 SpdyHeaderBlock SpdyBalsaUtils::ResponseHeadersToSpdyHeaders(
282 const BalsaHeaders& response_headers) { 292 const BalsaHeaders& response_headers) {
283 SpdyHeaderBlock block; 293 SpdyHeaderBlock block;
284 PopulateSpdyResponseHeaderBlock(HTTP2, response_headers, &block); 294 PopulateSpdyResponseHeaderBlock(HTTP2, response_headers, &block);
285 return block; 295 return block;
286 } 296 }
(...skipping 12 matching lines...) Expand all
299 SpdyHeadersToBalsaHeaders(block, headers, true); 309 SpdyHeadersToBalsaHeaders(block, headers, true);
300 } 310 }
301 311
302 // static 312 // static
303 void SpdyBalsaUtils::SpdyHeadersToRequestHeaders(const SpdyHeaderBlock& block, 313 void SpdyBalsaUtils::SpdyHeadersToRequestHeaders(const SpdyHeaderBlock& block,
304 BalsaHeaders* headers) { 314 BalsaHeaders* headers) {
305 SpdyHeadersToBalsaHeaders(block, headers, false); 315 SpdyHeadersToBalsaHeaders(block, headers, false);
306 } 316 }
307 317
308 } // namespace net 318 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_time_wait_list_manager_test.cc ('k') | net/tools/quic/spdy_balsa_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698