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

Unified Diff: net/base/net_util.cc

Issue 339017: Loosen RFC 1738 compliance check to allow underscores where we already allowe... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 29940)
+++ net/base/net_util.cc (working copy)
@@ -961,7 +961,7 @@
return (c >= '0') && (c <= '9');
}
-bool IsCanonicalizedHostRFC1738Compliant(const std::string& host) {
+bool IsCanonicalizedHostCompliant(const std::string& host) {
if (host.empty())
return false;
@@ -970,7 +970,7 @@
IN_COMPONENT_STARTED_DIGIT,
IN_COMPONENT_STARTED_ALPHA
} state = NOT_IN_COMPONENT;
- bool last_char_was_hyphen = false;
+ bool last_char_was_hyphen_or_underscore = false;
for (std::string::const_iterator i(host.begin()); i != host.end(); ++i) {
const char c = *i;
@@ -983,13 +983,13 @@
return false;
} else {
if (c == '.') {
- if (last_char_was_hyphen)
+ if (last_char_was_hyphen_or_underscore)
return false;
state = NOT_IN_COMPONENT;
} else if (IsHostCharAlpha(c) || IsHostCharDigit(c)) {
- last_char_was_hyphen = false;
- } else if (c == '-') {
- last_char_was_hyphen = true;
+ last_char_was_hyphen_or_underscore = false;
+ } else if ((c == '-') || (c == '_')) {
+ last_char_was_hyphen_or_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