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

Unified Diff: net/base/net_util.cc

Issue 10533102: Allow the omnibox to recognize as URLs inputs that have a host component that ends with a hyphen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
===================================================================
--- net/base/net_util.cc (revision 141606)
+++ net/base/net_util.cc (working copy)
@@ -1305,7 +1305,7 @@
bool in_component = false;
bool most_recent_component_started_alpha = false;
- bool last_char_was_hyphen_or_underscore = false;
+ bool last_char_was_underscore = false;
for (std::string::const_iterator i(host.begin()); i != host.end(); ++i) {
const char c = *i;
@@ -1317,13 +1317,13 @@
in_component = true;
} else {
if (c == '.') {
- if (last_char_was_hyphen_or_underscore)
+ if (last_char_was_underscore)
return false;
in_component = false;
- } else if (IsHostCharAlpha(c) || IsHostCharDigit(c)) {
- last_char_was_hyphen_or_underscore = false;
- } else if ((c == '-') || (c == '_')) {
- last_char_was_hyphen_or_underscore = true;
+ } else if (IsHostCharAlpha(c) || IsHostCharDigit(c) || (c == '-')) {
+ last_char_was_underscore = false;
+ } else if (c == '_') {
+ last_char_was_underscore = true;
} else {
return false;
}
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698