OLD | NEW |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |