| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 30 matching lines...) Expand all Loading... |
| 41 namespace url_parse { | 41 namespace url_parse { |
| 42 struct Parsed; | 42 struct Parsed; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace net { | 45 namespace net { |
| 46 | 46 |
| 47 // Used by FormatUrl to specify handling of certain parts of the url. | 47 // Used by FormatUrl to specify handling of certain parts of the url. |
| 48 typedef uint32 FormatUrlType; | 48 typedef uint32 FormatUrlType; |
| 49 typedef uint32 FormatUrlTypes; | 49 typedef uint32 FormatUrlTypes; |
| 50 | 50 |
| 51 // Used by GetHeaderParamValue to determine how to handle quotes in the value. | |
| 52 class QuoteRule { | |
| 53 public: | |
| 54 enum Type { | |
| 55 KEEP_OUTER_QUOTES, | |
| 56 REMOVE_OUTER_QUOTES, | |
| 57 }; | |
| 58 | |
| 59 private: | |
| 60 QuoteRule(); | |
| 61 }; | |
| 62 | |
| 63 // Nothing is ommitted. | 51 // Nothing is ommitted. |
| 64 NET_EXPORT extern const FormatUrlType kFormatUrlOmitNothing; | 52 NET_EXPORT extern const FormatUrlType kFormatUrlOmitNothing; |
| 65 | 53 |
| 66 // If set, any username and password are removed. | 54 // If set, any username and password are removed. |
| 67 NET_EXPORT extern const FormatUrlType kFormatUrlOmitUsernamePassword; | 55 NET_EXPORT extern const FormatUrlType kFormatUrlOmitUsernamePassword; |
| 68 | 56 |
| 69 // If the scheme is 'http://', it's removed. | 57 // If the scheme is 'http://', it's removed. |
| 70 NET_EXPORT extern const FormatUrlType kFormatUrlOmitHTTP; | 58 NET_EXPORT extern const FormatUrlType kFormatUrlOmitHTTP; |
| 71 | 59 |
| 72 // Omits the path if it is just a slash and there is no query or ref. This is | 60 // Omits the path if it is just a slash and there is no query or ref. This is |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 125 |
| 138 // Returns either the host from |url|, or, if the host is empty, the full spec. | 126 // Returns either the host from |url|, or, if the host is empty, the full spec. |
| 139 NET_EXPORT std::string GetHostOrSpecFromURL(const GURL& url); | 127 NET_EXPORT std::string GetHostOrSpecFromURL(const GURL& url); |
| 140 | 128 |
| 141 // Return the value of the HTTP response header with name 'name'. 'headers' | 129 // Return the value of the HTTP response header with name 'name'. 'headers' |
| 142 // should be in the format that URLRequest::GetResponseHeaders() returns. | 130 // should be in the format that URLRequest::GetResponseHeaders() returns. |
| 143 // Returns the empty string if the header is not found. | 131 // Returns the empty string if the header is not found. |
| 144 NET_EXPORT std::string GetSpecificHeader(const std::string& headers, | 132 NET_EXPORT std::string GetSpecificHeader(const std::string& headers, |
| 145 const std::string& name); | 133 const std::string& name); |
| 146 | 134 |
| 147 // Return the value of the HTTP response header field's parameter named | |
| 148 // 'param_name'. Returns the empty string if the parameter is not found or is | |
| 149 // improperly formatted. | |
| 150 NET_EXPORT std::string GetHeaderParamValue(const std::string& header, | |
| 151 const std::string& param_name, | |
| 152 QuoteRule::Type quote_rule); | |
| 153 | |
| 154 // TODO(abarth): Move these functions to http_content_disposition.cc. | 135 // TODO(abarth): Move these functions to http_content_disposition.cc. |
| 155 bool DecodeFilenameValue(const std::string& input, | 136 bool DecodeFilenameValue(const std::string& input, |
| 156 const std::string& referrer_charset, | 137 const std::string& referrer_charset, |
| 157 std::string* output); | 138 std::string* output); |
| 158 bool DecodeExtValue(const std::string& value, std::string* output); | 139 bool DecodeExtValue(const std::string& value, std::string* output); |
| 159 | 140 |
| 160 // Converts the given host name to unicode characters. This can be called for | 141 // Converts the given host name to unicode characters. This can be called for |
| 161 // any host name, if the input is not IDN or is invalid in some way, we'll just | 142 // any host name, if the input is not IDN or is invalid in some way, we'll just |
| 162 // return the ASCII source so it is still usable. | 143 // return the ASCII source so it is still usable. |
| 163 // | 144 // |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 467 |
| 487 // Returns list of network interfaces except loopback interface. If an | 468 // Returns list of network interfaces except loopback interface. If an |
| 488 // interface has more than one address, a separate entry is added to | 469 // interface has more than one address, a separate entry is added to |
| 489 // the list for each address. | 470 // the list for each address. |
| 490 // Can be called only on a thread that allows IO. | 471 // Can be called only on a thread that allows IO. |
| 491 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); | 472 NET_EXPORT bool GetNetworkList(NetworkInterfaceList* networks); |
| 492 | 473 |
| 493 } // namespace net | 474 } // namespace net |
| 494 | 475 |
| 495 #endif // NET_BASE_NET_UTIL_H_ | 476 #endif // NET_BASE_NET_UTIL_H_ |
| OLD | NEW |