OLD | NEW |
1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Same as NetAddressToString, but additionally includes the port number. For | 99 // Same as NetAddressToString, but additionally includes the port number. For |
100 // example: "192.168.0.1:99" or "[::1]:80". | 100 // example: "192.168.0.1:99" or "[::1]:80". |
101 std::string NetAddressToStringWithPort(const struct addrinfo* net_address); | 101 std::string NetAddressToStringWithPort(const struct addrinfo* net_address); |
102 | 102 |
103 // Returns the hostname of the current system. Returns empty string on failure. | 103 // Returns the hostname of the current system. Returns empty string on failure. |
104 std::string GetHostName(); | 104 std::string GetHostName(); |
105 | 105 |
106 // Extracts the unescaped username/password from |url|, saving the results | 106 // Extracts the unescaped username/password from |url|, saving the results |
107 // into |*username| and |*password|. | 107 // into |*username| and |*password|. |
108 void GetIdentityFromURL(const GURL& url, | 108 void GetIdentityFromURL(const GURL& url, |
109 std::wstring* username, | 109 string16* username, |
110 std::wstring* password); | 110 string16* password); |
111 | 111 |
112 // Returns either the host from |url|, or, if the host is empty, the full spec. | 112 // Returns either the host from |url|, or, if the host is empty, the full spec. |
113 std::string GetHostOrSpecFromURL(const GURL& url); | 113 std::string GetHostOrSpecFromURL(const GURL& url); |
114 | 114 |
115 // Return the value of the HTTP response header with name 'name'. 'headers' | 115 // Return the value of the HTTP response header with name 'name'. 'headers' |
116 // should be in the format that URLRequest::GetResponseHeaders() returns. | 116 // should be in the format that URLRequest::GetResponseHeaders() returns. |
117 // Returns the empty string if the header is not found. | 117 // Returns the empty string if the header is not found. |
118 std::wstring GetSpecificHeader(const std::wstring& headers, | 118 std::wstring GetSpecificHeader(const std::wstring& headers, |
119 const std::wstring& name); | 119 const std::wstring& name); |
120 std::string GetSpecificHeader(const std::string& headers, | 120 std::string GetSpecificHeader(const std::string& headers, |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 // Returns the port field of the sockaddr in |info|. | 380 // Returns the port field of the sockaddr in |info|. |
381 uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info); | 381 uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info); |
382 | 382 |
383 // Returns the value of |info's| port (in host byte ordering). | 383 // Returns the value of |info's| port (in host byte ordering). |
384 int GetPortFromAddrinfo(const struct addrinfo* info); | 384 int GetPortFromAddrinfo(const struct addrinfo* info); |
385 | 385 |
386 } // namespace net | 386 } // namespace net |
387 | 387 |
388 #endif // NET_BASE_NET_UTIL_H_ | 388 #endif // NET_BASE_NET_UTIL_H_ |
OLD | NEW |