summaryrefslogtreecommitdiffstats
path: root/net/base/net_util.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 22:11:00 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-21 22:11:00 +0000
commitb26a4d9280981c0ec7478da6de89e316f3f13e78 (patch)
tree775ea8ee8c9ff7ddb000009d39e64266327c9601 /net/base/net_util.cc
parent32bf6acbf1196a545a53e0c81ed5879bf58b70f9 (diff)
downloadchromium_src-b26a4d9280981c0ec7478da6de89e316f3f13e78.zip
chromium_src-b26a4d9280981c0ec7478da6de89e316f3f13e78.tar.gz
chromium_src-b26a4d9280981c0ec7478da6de89e316f3f13e78.tar.bz2
Allow hyphens at the beginning of domain components, except for the last domain component.
This is an intentional relaxation of the rules from RFC 1738 to accommodate real-world URLs like http://-kol.deviantart.com/ and http://-tumblrprincess.tumblr.com/. BUG=31060 TEST=Type one of the above URLs in the Chrome omnibox and hit enter; you should navigate, not search. Review URL: http://codereview.chromium.org/7222019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89907 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_util.cc')
-rw-r--r--net/base/net_util.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 0dd824b..6b706d1 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -1181,7 +1181,8 @@ bool IsCanonicalizedHostCompliant(const std::string& host,
const char c = *i;
if (!in_component) {
most_recent_component_started_alpha = IsHostCharAlpha(c);
- if (!most_recent_component_started_alpha && !IsHostCharDigit(c))
+ if (!most_recent_component_started_alpha && !IsHostCharDigit(c) &&
+ (c != '-'))
return false;
in_component = true;
} else {