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

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

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 years, 4 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 | « net/base/net_util.h ('k') | net/base/net_util_icu.cc » ('j') | 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/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 UnescapeRule::Type flags = 425 UnescapeRule::Type flags =
426 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS; 426 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS;
427 *username = UnescapeAndDecodeUTF8URLComponent(url.username(), flags); 427 *username = UnescapeAndDecodeUTF8URLComponent(url.username(), flags);
428 *password = UnescapeAndDecodeUTF8URLComponent(url.password(), flags); 428 *password = UnescapeAndDecodeUTF8URLComponent(url.password(), flags);
429 } 429 }
430 430
431 std::string GetHostOrSpecFromURL(const GURL& url) { 431 std::string GetHostOrSpecFromURL(const GURL& url) {
432 return url.has_host() ? TrimEndingDot(url.host()) : url.spec(); 432 return url.has_host() ? TrimEndingDot(url.host()) : url.spec();
433 } 433 }
434 434
435 bool CanStripTrailingSlash(const GURL& url) {
436 // Omit the path only for standard, non-file URLs with nothing but "/" after
437 // the hostname.
438 return url.IsStandard() && !url.SchemeIsFile() &&
439 !url.SchemeIsFileSystem() && !url.has_query() && !url.has_ref()
440 && url.path() == "/";
441 }
442
443 GURL SimplifyUrlForRequest(const GURL& url) { 435 GURL SimplifyUrlForRequest(const GURL& url) {
444 DCHECK(url.is_valid()); 436 DCHECK(url.is_valid());
445 GURL::Replacements replacements; 437 GURL::Replacements replacements;
446 replacements.ClearUsername(); 438 replacements.ClearUsername();
447 replacements.ClearPassword(); 439 replacements.ClearPassword();
448 replacements.ClearRef(); 440 replacements.ClearRef();
449 return url.ReplaceComponents(replacements); 441 return url.ReplaceComponents(replacements);
450 } 442 }
451 443
452 bool HaveOnlyLoopbackAddresses() { 444 bool HaveOnlyLoopbackAddresses() {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 }; 623 };
632 const std::string& host = url.host(); 624 const std::string& host = url.host();
633 for (const char* suffix : kGoogleHostSuffixes) { 625 for (const char* suffix : kGoogleHostSuffixes) {
634 if (base::EndsWith(host, suffix, base::CompareCase::INSENSITIVE_ASCII)) 626 if (base::EndsWith(host, suffix, base::CompareCase::INSENSITIVE_ASCII))
635 return true; 627 return true;
636 } 628 }
637 return false; 629 return false;
638 } 630 }
639 631
640 } // namespace net 632 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_icu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698