OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file contains a set of utility functions related to parsing, | 5 // This file contains a set of utility functions related to parsing, |
6 // manipulating, and interacting with URLs and hostnames. These functions are | 6 // manipulating, and interacting with URLs and hostnames. These functions are |
7 // intended to be of a text-processing nature, and should not attempt to use any | 7 // intended to be of a text-processing nature, and should not attempt to use any |
8 // networking or blocking services. | 8 // networking or blocking services. |
9 | 9 |
10 #ifndef NET_BASE_URL_UTIL_H_ | 10 #ifndef NET_BASE_URL_UTIL_H_ |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 NET_EXPORT bool IsHostnameNonUnique(const std::string& hostname); | 143 NET_EXPORT bool IsHostnameNonUnique(const std::string& hostname); |
144 | 144 |
145 // Returns true if |host| is one of the local hostnames | 145 // Returns true if |host| is one of the local hostnames |
146 // (e.g. "localhost") or IP addresses (IPv4 127.0.0.0/8 or IPv6 ::1). | 146 // (e.g. "localhost") or IP addresses (IPv4 127.0.0.0/8 or IPv6 ::1). |
147 // | 147 // |
148 // Note that this function does not check for IP addresses other than | 148 // Note that this function does not check for IP addresses other than |
149 // the above, although other IP addresses may point to the local | 149 // the above, although other IP addresses may point to the local |
150 // machine. | 150 // machine. |
151 NET_EXPORT bool IsLocalhost(base::StringPiece host); | 151 NET_EXPORT bool IsLocalhost(base::StringPiece host); |
152 | 152 |
| 153 // Checks whether or not two URL are an in-page navigation (differing only in |
| 154 // the fragment). |
| 155 NET_EXPORT bool AreURLsInPageNavigation(const GURL& existing_url, |
| 156 const GURL& new_url); |
| 157 |
153 // Strip the portions of |url| that aren't core to the network request. | 158 // Strip the portions of |url| that aren't core to the network request. |
154 // - user name / password | 159 // - user name / password |
155 // - reference section | 160 // - reference section |
156 NET_EXPORT GURL SimplifyUrlForRequest(const GURL& url); | 161 NET_EXPORT GURL SimplifyUrlForRequest(const GURL& url); |
157 | 162 |
158 // Extracts the unescaped username/password from |url|, saving the results | 163 // Extracts the unescaped username/password from |url|, saving the results |
159 // into |*username| and |*password|. | 164 // into |*username| and |*password|. |
160 NET_EXPORT_PRIVATE void GetIdentityFromURL(const GURL& url, | 165 NET_EXPORT_PRIVATE void GetIdentityFromURL(const GURL& url, |
161 base::string16* username, | 166 base::string16* username, |
162 base::string16* password); | 167 base::string16* password); |
163 | 168 |
164 // Returns true if the url's host is a Google server. This should only be used | 169 // Returns true if the url's host is a Google server. This should only be used |
165 // for histograms and shouldn't be used to affect behavior. | 170 // for histograms and shouldn't be used to affect behavior. |
166 NET_EXPORT_PRIVATE bool HasGoogleHost(const GURL& url); | 171 NET_EXPORT_PRIVATE bool HasGoogleHost(const GURL& url); |
167 | 172 |
168 // This function tests |host| to see if it is of any local hostname form. | 173 // This function tests |host| to see if it is of any local hostname form. |
169 // |host| is normalized before being tested and if |is_local6| is not NULL then | 174 // |host| is normalized before being tested and if |is_local6| is not NULL then |
170 // it it will be set to true if the localhost name implies an IPv6 interface ( | 175 // it it will be set to true if the localhost name implies an IPv6 interface ( |
171 // for instance localhost6.localdomain6). | 176 // for instance localhost6.localdomain6). |
172 NET_EXPORT_PRIVATE bool IsLocalHostname(base::StringPiece host, | 177 NET_EXPORT_PRIVATE bool IsLocalHostname(base::StringPiece host, |
173 bool* is_local6); | 178 bool* is_local6); |
174 | 179 |
175 } // namespace net | 180 } // namespace net |
176 | 181 |
177 #endif // NET_BASE_URL_UTIL_H_ | 182 #endif // NET_BASE_URL_UTIL_H_ |
OLD | NEW |