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

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

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, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #ifdef OS_WIN 10 #ifdef OS_WIN
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const std::wstring& languages, 151 const std::wstring& languages,
152 std::wstring* out); 152 std::wstring* out);
153 153
154 // Canonicalizes |host| and returns it. Also fills |host_info| with 154 // Canonicalizes |host| and returns it. Also fills |host_info| with
155 // IP address information. |host_info| must not be NULL. 155 // IP address information. |host_info| must not be NULL.
156 std::string CanonicalizeHost(const std::string& host, 156 std::string CanonicalizeHost(const std::string& host,
157 url_canon::CanonHostInfo* host_info); 157 url_canon::CanonHostInfo* host_info);
158 std::string CanonicalizeHost(const std::wstring& host, 158 std::string CanonicalizeHost(const std::wstring& host,
159 url_canon::CanonHostInfo* host_info); 159 url_canon::CanonHostInfo* host_info);
160 160
161 // Returns true if |host| is RFC 1738-compliant (and not an IP address). The 161 // Returns true if |host| is not an IP address and is compliant with a set of
162 // rules are: 162 // rules based on RFC 1738 and tweaked to be compatible with the real world.
163 // The rules are:
163 // * One or more components separated by '.' 164 // * One or more components separated by '.'
164 // * Each component begins and ends with an alphanumeric character 165 // * Each component begins and ends with an alphanumeric character
165 // * Each component contains only alphanumeric characters and '-' 166 // * Each component contains only alphanumeric characters and '-' or '_'
166 // * The last component does not begin with a digit 167 // * The last component does not begin with a digit
167 // 168 //
168 // NOTE: You should only pass in hosts that have been returned from 169 // NOTE: You should only pass in hosts that have been returned from
169 // CanonicalizeHost(), or you may not get accurate results. 170 // CanonicalizeHost(), or you may not get accurate results.
170 bool IsCanonicalizedHostRFC1738Compliant(const std::string& host); 171 bool IsCanonicalizedHostCompliant(const std::string& host);
171 172
172 // Call these functions to get the html snippet for a directory listing. 173 // Call these functions to get the html snippet for a directory listing.
173 // The return values of both functions are in UTF-8. 174 // The return values of both functions are in UTF-8.
174 std::string GetDirectoryListingHeader(const string16& title); 175 std::string GetDirectoryListingHeader(const string16& title);
175 176
176 // Given the name of a file in a directory (ftp or local) and 177 // Given the name of a file in a directory (ftp or local) and
177 // other information (is_dir, size, modification time), it returns 178 // other information (is_dir, size, modification time), it returns
178 // the html snippet to add the entry for the file to the directory listing. 179 // the html snippet to add the entry for the file to the directory listing.
179 // Currently, it's a script tag containing a call to a Javascript function 180 // Currently, it's a script tag containing a call to a Javascript function
180 // |addRow|. 181 // |addRow|.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // Strip the portions of |url| that aren't core to the network request. 257 // Strip the portions of |url| that aren't core to the network request.
257 // - user name / password 258 // - user name / password
258 // - reference section 259 // - reference section
259 GURL SimplifyUrlForRequest(const GURL& url); 260 GURL SimplifyUrlForRequest(const GURL& url);
260 261
261 void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports); 262 void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports);
262 263
263 } // namespace net 264 } // namespace net
264 265
265 #endif // NET_BASE_NET_UTIL_H_ 266 #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