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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/url_util.cc
diff --git a/net/base/url_util.cc b/net/base/url_util.cc
index 111c95400a821e9ab53a8ec3fd7988e35c92243e..062481fef392c9a9b103e152f86932addb997757 100644
--- a/net/base/url_util.cc
+++ b/net/base/url_util.cc
@@ -373,6 +373,9 @@ bool IsLocalhost(base::StringPiece host) {
GURL SimplifyUrlForRequest(const GURL& url) {
DCHECK(url.is_valid());
+ // Fast path to avoid re-canonicalization via ReplaceComponents.
+ if (!url.has_username() && !url.has_password() && !url.has_ref())
+ return url;
GURL::Replacements replacements;
replacements.ClearUsername();
replacements.ClearPassword();
« 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