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

Side by Side Diff: net/base/url_util.cc

Issue 2498423004: net::SimplifyUrlForRequest fast path for URLs without {user,pass,ref} parts. (Closed)
Patch Set: Created 4 years, 1 month 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 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/base/url_util.h" 5 #include "net/base/url_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <netinet/in.h> 10 #include <netinet/in.h>
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 default: 366 default:
367 NOTREACHED(); 367 NOTREACHED();
368 } 368 }
369 } 369 }
370 370
371 return false; 371 return false;
372 } 372 }
373 373
374 GURL SimplifyUrlForRequest(const GURL& url) { 374 GURL SimplifyUrlForRequest(const GURL& url) {
375 DCHECK(url.is_valid()); 375 DCHECK(url.is_valid());
376 // Fast path to avoid re-canonicalization via ReplaceComponents.
377 if (!url.has_username() && !url.has_password() && !url.has_ref())
378 return url;
376 GURL::Replacements replacements; 379 GURL::Replacements replacements;
377 replacements.ClearUsername(); 380 replacements.ClearUsername();
378 replacements.ClearPassword(); 381 replacements.ClearPassword();
379 replacements.ClearRef(); 382 replacements.ClearRef();
380 return url.ReplaceComponents(replacements); 383 return url.ReplaceComponents(replacements);
381 } 384 }
382 385
383 void GetIdentityFromURL(const GURL& url, 386 void GetIdentityFromURL(const GURL& url,
384 base::string16* username, 387 base::string16* username,
385 base::string16* password) { 388 base::string16* password) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 433 }
431 434
432 if (is_local6) 435 if (is_local6)
433 *is_local6 = false; 436 *is_local6 = false;
434 return normalized_host == "localhost" || 437 return normalized_host == "localhost" ||
435 normalized_host == "localhost.localdomain" || 438 normalized_host == "localhost.localdomain" ||
436 IsNormalizedLocalhostTLD(normalized_host); 439 IsNormalizedLocalhostTLD(normalized_host);
437 } 440 }
438 441
439 } // namespace net 442 } // 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