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

Side by Side Diff: net/base/net_util.h

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_unittest.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_NET_UTIL_H_ 5 #ifndef NET_BASE_NET_UTIL_H_
6 #define NET_BASE_NET_UTIL_H_ 6 #define NET_BASE_NET_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // IP address information. |host_info| must not be NULL. 165 // IP address information. |host_info| must not be NULL.
166 NET_EXPORT std::string CanonicalizeHost(const std::string& host, 166 NET_EXPORT std::string CanonicalizeHost(const std::string& host,
167 url_canon::CanonHostInfo* host_info); 167 url_canon::CanonHostInfo* host_info);
168 168
169 // Returns true if |host| is not an IP address and is compliant with a set of 169 // Returns true if |host| is not an IP address and is compliant with a set of
170 // rules based on RFC 1738 and tweaked to be compatible with the real world. 170 // rules based on RFC 1738 and tweaked to be compatible with the real world.
171 // The rules are: 171 // The rules are:
172 // * One or more components separated by '.' 172 // * One or more components separated by '.'
173 // * Each component begins with an alphanumeric character or '-' 173 // * Each component begins with an alphanumeric character or '-'
174 // * Each component contains only alphanumeric characters and '-' or '_' 174 // * Each component contains only alphanumeric characters and '-' or '_'
175 // * Each component ends with an alphanumeric character 175 // * Each component ends with an alphanumeric character or '-'
176 // * The last component begins with an alphabetic character 176 // * The last component begins with an alphabetic character
177 // * Optional trailing dot after last component (means "treat as FQDN") 177 // * Optional trailing dot after last component (means "treat as FQDN")
178 // If |desired_tld| is non-NULL, the host will only be considered invalid if 178 // If |desired_tld| is non-NULL, the host will only be considered invalid if
179 // appending it as a trailing component still results in an invalid host. This 179 // appending it as a trailing component still results in an invalid host. This
180 // helps us avoid marking as "invalid" user attempts to open "www.401k.com" by 180 // helps us avoid marking as "invalid" user attempts to open "www.401k.com" by
181 // typing 4-0-1-k-<ctrl>+<enter>. 181 // typing 4-0-1-k-<ctrl>+<enter>.
182 // 182 //
183 // NOTE: You should only pass in hosts that have been returned from 183 // NOTE: You should only pass in hosts that have been returned from
184 // CanonicalizeHost(), or you may not get accurate results. 184 // CanonicalizeHost(), or you may not get accurate results.
185 NET_EXPORT bool IsCanonicalizedHostCompliant(const std::string& host, 185 NET_EXPORT bool IsCanonicalizedHostCompliant(const std::string& host,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 // Returns list of network interfaces except loopback interface. If an 452 // Returns list of network interfaces except loopback interface. If an
453 // interface has more than one address, a separate entry is added to 453 // interface has more than one address, a separate entry is added to
454 // the list for each address. 454 // the list for each address.
455 // Can be called only on a thread that allows IO. 455 // Can be called only on a thread that allows IO.
456 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); 456 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks);
457 457
458 } // namespace net 458 } // namespace net
459 459
460 #endif // NET_BASE_NET_UTIL_H_ 460 #endif // NET_BASE_NET_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_unittest.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698