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

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

Issue 1749303002: Transition to new BalsaUrl/HttpRequestInfo interfaces in gfe/gfe2/quic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@115444705
Patch Set: Revert to Patch Set 1 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 | « no previous file | 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/spdy_balsa_utils.h" 5 #include "net/tools/quic/spdy_balsa_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 SpdyHeaderBlock SpdyBalsaUtils::RequestHeadersToSpdyHeaders( 220 SpdyHeaderBlock SpdyBalsaUtils::RequestHeadersToSpdyHeaders(
221 const BalsaHeaders& request_headers) { 221 const BalsaHeaders& request_headers) {
222 string scheme; 222 string scheme;
223 string host_and_port; 223 string host_and_port;
224 string path; 224 string path;
225 225
226 string url = request_headers.request_uri().as_string(); 226 string url = request_headers.request_uri().as_string();
227 if (url.empty() || url[0] == '/') { 227 if (url.empty() || url[0] == '/') {
228 path = url; 228 path = url;
229 } else { 229 } else {
230 GURL request_uri(url); 230 std::unique_ptr<GURL> request_uri(new GURL(url));
231 if (request_headers.request_method() == "CONNECT") { 231 if (request_headers.request_method() == "CONNECT") {
232 path = url; 232 path = url;
233 } else { 233 } else {
234 path = request_uri.path(); 234 path = request_uri->path();
235 if (!request_uri.query().empty()) { 235 if (!request_uri->query().empty()) {
236 path = path + "?" + request_uri.query(); 236 path = path + "?" + request_uri->query();
237 } 237 }
238 host_and_port = request_uri.host(); 238 host_and_port = request_uri->host();
239 scheme = request_uri.scheme(); 239 scheme = request_uri->scheme();
240 } 240 }
241 } 241 }
242 242
243 DCHECK(!scheme.empty()); 243 DCHECK(!scheme.empty());
244 DCHECK(!host_and_port.empty()); 244 DCHECK(!host_and_port.empty());
245 DCHECK(!path.empty()); 245 DCHECK(!path.empty());
246 246
247 SpdyHeaderBlock block; 247 SpdyHeaderBlock block;
248 PopulateSpdy4RequestHeaderBlock(request_headers, scheme, host_and_port, path, 248 PopulateSpdy4RequestHeaderBlock(request_headers, scheme, host_and_port, path,
249 &block); 249 &block);
(...skipping 23 matching lines...) Expand all
273 SpdyHeaderValidatorType::RESPONSE_HEADER); 273 SpdyHeaderValidatorType::RESPONSE_HEADER);
274 } 274 }
275 275
276 // static 276 // static
277 void SpdyBalsaUtils::SpdyHeadersToRequestHeaders(const SpdyHeaderBlock& block, 277 void SpdyBalsaUtils::SpdyHeadersToRequestHeaders(const SpdyHeaderBlock& block,
278 BalsaHeaders* headers) { 278 BalsaHeaders* headers) {
279 SpdyHeadersToBalsaHeaders(block, headers, SpdyHeaderValidatorType::REQUEST); 279 SpdyHeadersToBalsaHeaders(block, headers, SpdyHeaderValidatorType::REQUEST);
280 } 280 }
281 281
282 } // namespace net 282 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698