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

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: Compile fixes following rebase Created 5 years, 6 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/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 UnescapeRule::Type flags = 561 UnescapeRule::Type flags =
562 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS; 562 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS;
563 *username = UnescapeAndDecodeUTF8URLComponent(url.username(), flags); 563 *username = UnescapeAndDecodeUTF8URLComponent(url.username(), flags);
564 *password = UnescapeAndDecodeUTF8URLComponent(url.password(), flags); 564 *password = UnescapeAndDecodeUTF8URLComponent(url.password(), flags);
565 } 565 }
566 566
567 std::string GetHostOrSpecFromURL(const GURL& url) { 567 std::string GetHostOrSpecFromURL(const GURL& url) {
568 return url.has_host() ? TrimEndingDot(url.host()) : url.spec(); 568 return url.has_host() ? TrimEndingDot(url.host()) : url.spec();
569 } 569 }
570 570
571 bool CanStripTrailingSlash(const GURL& url) {
572 // Omit the path only for standard, non-file URLs with nothing but "/" after
573 // the hostname.
574 return url.IsStandard() && !url.SchemeIsFile() &&
575 !url.SchemeIsFileSystem() && !url.has_query() && !url.has_ref()
576 && url.path() == "/";
577 }
578
579 GURL SimplifyUrlForRequest(const GURL& url) { 571 GURL SimplifyUrlForRequest(const GURL& url) {
580 DCHECK(url.is_valid()); 572 DCHECK(url.is_valid());
581 GURL::Replacements replacements; 573 GURL::Replacements replacements;
582 replacements.ClearUsername(); 574 replacements.ClearUsername();
583 replacements.ClearPassword(); 575 replacements.ClearPassword();
584 replacements.ClearRef(); 576 replacements.ClearRef();
585 return url.ReplaceComponents(replacements); 577 return url.ReplaceComponents(replacements);
586 } 578 }
587 579
588 // Specifies a comma separated list of port numbers that should be accepted 580 // Specifies a comma separated list of port numbers that should be accepted
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 }; 790 };
799 const std::string& host = url.host(); 791 const std::string& host = url.host();
800 for (const char* suffix : kGoogleHostSuffixes) { 792 for (const char* suffix : kGoogleHostSuffixes) {
801 if (EndsWith(host, suffix, false)) 793 if (EndsWith(host, suffix, false))
802 return true; 794 return true;
803 } 795 }
804 return false; 796 return false;
805 } 797 }
806 798
807 } // namespace net 799 } // namespace net
OLDNEW
« ios/web/DEPS ('K') | « 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