diff options
author | maruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-08 19:06:43 +0000 |
---|---|---|
committer | maruel@google.com <maruel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-08 19:06:43 +0000 |
commit | f24ab372e7f2ace6a67e0d1d3fc02e793202d8e9 (patch) | |
tree | 2f1ec6590be11056b1a808369c836a707c984b13 /net/base/net_util.cc | |
parent | 66b2bc1ccd6a7d41b71b602b2983aa81527f9c8f (diff) | |
download | chromium_src-f24ab372e7f2ace6a67e0d1d3fc02e793202d8e9.zip chromium_src-f24ab372e7f2ace6a67e0d1d3fc02e793202d8e9.tar.gz chromium_src-f24ab372e7f2ace6a67e0d1d3fc02e793202d8e9.tar.bz2 |
Revert 3024, broke mac build.
Review URL: http://codereview.chromium.org/6351
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3027 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_util.cc')
-rw-r--r-- | net/base/net_util.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 305cbcc..57448af 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -913,4 +913,26 @@ bool IsPortAllowedByFtp(int port) { return IsPortAllowedByDefault(port); } +std::string GetImplicitPort(const GURL& url) { + if (url.has_port()) + return url.port(); + + // TODO(eroman): unify with DefaultPortForScheme() + // [url_canon_stdurl.cc] + + static const struct { + const char* scheme; + const char* port; + } scheme_map[] = { + { "http", "80" }, + { "https", "443" }, + { "ftp", "21" } + }; + for (int i = 0; i < static_cast<int>(ARRAYSIZE_UNSAFE(scheme_map)); ++i) { + if (url.SchemeIs(scheme_map[i].scheme)) + return scheme_map[i].port; + } + return std::string(""); +} + } // namespace net |