diff options
author | pkasting <pkasting@chromium.org> | 2015-05-06 13:26:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-06 20:27:26 +0000 |
commit | f9487601c410591159203d1acc9c4f1372534f4b (patch) | |
tree | 5c9e193972b85eb9aa1cc8889ad263b8ae2a3106 /net/base/net_util.cc | |
parent | 41b266f49048d02b5c6d89b04a4dcaf993f6fd10 (diff) | |
download | chromium_src-f9487601c410591159203d1acc9c4f1372534f4b.zip chromium_src-f9487601c410591159203d1acc9c4f1372534f4b.tar.gz chromium_src-f9487601c410591159203d1acc9c4f1372534f4b.tar.bz2 |
Relax the canonical host requirements yet further.
Apparently there are sites using "_" as a standalone host component. Ugh.
BUG=324310
TEST=Type "_.bjb.io" (no quotes) into the address bar and check that the default action is to navigate
Review URL: https://codereview.chromium.org/1119173004
Cr-Commit-Position: refs/heads/master@{#328600}
Diffstat (limited to 'net/base/net_util.cc')
-rw-r--r-- | net/base/net_util.cc | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc index d304897..26868a0 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -258,27 +258,20 @@ bool IsCanonicalizedHostCompliant(const std::string& host) { bool in_component = false; bool most_recent_component_started_alphanumeric = false; - bool last_char_was_underscore = false; for (std::string::const_iterator i(host.begin()); i != host.end(); ++i) { const char c = *i; if (!in_component) { most_recent_component_started_alphanumeric = IsHostCharAlphanumeric(c); - if (!most_recent_component_started_alphanumeric && (c != '-')) - return false; - in_component = true; - } else { - if (c == '.') { - if (last_char_was_underscore) - return false; - in_component = false; - } else if (IsHostCharAlphanumeric(c) || (c == '-')) { - last_char_was_underscore = false; - } else if (c == '_') { - last_char_was_underscore = true; - } else { + if (!most_recent_component_started_alphanumeric && (c != '-') && + (c != '_')) { return false; } + in_component = true; + } else if (c == '.') { + in_component = false; + } else if (!IsHostCharAlphanumeric(c) && (c != '-') && (c != '_')) { + return false; } } |