OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
11 #include <windows.h> | 11 #include <windows.h> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 // Returns the hostname of the current system. Returns empty string on failure. | 77 // Returns the hostname of the current system. Returns empty string on failure. |
78 std::string GetHostName(); | 78 std::string GetHostName(); |
79 | 79 |
80 // Extracts the unescaped username/password from |url|, saving the results | 80 // Extracts the unescaped username/password from |url|, saving the results |
81 // into |*username| and |*password|. | 81 // into |*username| and |*password|. |
82 void GetIdentityFromURL(const GURL& url, | 82 void GetIdentityFromURL(const GURL& url, |
83 std::wstring* username, | 83 std::wstring* username, |
84 std::wstring* password); | 84 std::wstring* password); |
85 | 85 |
| 86 // Returns either the host from |url|, or, if the host is empty, the full spec. |
| 87 std::string GetHostOrSpecFromURL(const GURL& url); |
| 88 |
86 // Return the value of the HTTP response header with name 'name'. 'headers' | 89 // Return the value of the HTTP response header with name 'name'. 'headers' |
87 // should be in the format that URLRequest::GetResponseHeaders() returns. | 90 // should be in the format that URLRequest::GetResponseHeaders() returns. |
88 // Returns the empty string if the header is not found. | 91 // Returns the empty string if the header is not found. |
89 std::wstring GetSpecificHeader(const std::wstring& headers, | 92 std::wstring GetSpecificHeader(const std::wstring& headers, |
90 const std::wstring& name); | 93 const std::wstring& name); |
91 std::string GetSpecificHeader(const std::string& headers, | 94 std::string GetSpecificHeader(const std::string& headers, |
92 const std::string& name); | 95 const std::string& name); |
93 | 96 |
94 // Return the value of the HTTP response header field's parameter named | 97 // Return the value of the HTTP response header field's parameter named |
95 // 'param_name'. Returns the empty string if the parameter is not found or is | 98 // 'param_name'. Returns the empty string if the parameter is not found or is |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports); | 292 void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports); |
290 | 293 |
291 // Perform a simplistic test to see if IPv6 is supported by trying to create an | 294 // Perform a simplistic test to see if IPv6 is supported by trying to create an |
292 // IPv6 socket. | 295 // IPv6 socket. |
293 // TODO(jar): Make test more in-depth as needed. | 296 // TODO(jar): Make test more in-depth as needed. |
294 bool IPv6Supported(); | 297 bool IPv6Supported(); |
295 | 298 |
296 } // namespace net | 299 } // namespace net |
297 | 300 |
298 #endif // NET_BASE_NET_UTIL_H_ | 301 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |