| 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_PROXY_PROXY_SERVER_H_ | 5 #ifndef NET_PROXY_PROXY_SERVER_H_ |
| 6 #define NET_PROXY_PROXY_SERVER_H_ | 6 #define NET_PROXY_PROXY_SERVER_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
| 11 #include <CoreFoundation/CoreFoundation.h> | 11 #include <CoreFoundation/CoreFoundation.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include "net/base/host_port_pair.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 | 18 |
| 18 // ProxyServer encodes the {type, host, port} of a proxy server. | 19 // ProxyServer encodes the {type, host, port} of a proxy server. |
| 19 // ProxyServer is immutable. | 20 // ProxyServer is immutable. |
| 20 class ProxyServer { | 21 class ProxyServer { |
| 21 public: | 22 public: |
| 22 // The type of proxy. These are defined as bit flags so they can be ORed | 23 // The type of proxy. These are defined as bit flags so they can be ORed |
| 23 // together to pass as the |scheme_bit_field| argument to | 24 // together to pass as the |scheme_bit_field| argument to |
| 24 // ProxyService::RemoveProxiesWithoutScheme(). | 25 // ProxyService::RemoveProxiesWithoutScheme(). |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 59 |
| 59 // Gets the host portion of the proxy server. If the host portion is an | 60 // Gets the host portion of the proxy server. If the host portion is an |
| 60 // IPv6 literal address, the return value does not include the square | 61 // IPv6 literal address, the return value does not include the square |
| 61 // brackets ([]) used to separate it from the port portion. | 62 // brackets ([]) used to separate it from the port portion. |
| 62 std::string HostNoBrackets() const; | 63 std::string HostNoBrackets() const; |
| 63 | 64 |
| 64 // Gets the port portion of the proxy server. | 65 // Gets the port portion of the proxy server. |
| 65 int port() const; | 66 int port() const; |
| 66 | 67 |
| 67 // Returns the <host>":"<port> string for the proxy server. | 68 // Returns the <host>":"<port> string for the proxy server. |
| 69 // TODO(willchan): Remove in favor of host_port_pair(). |
| 68 std::string host_and_port() const; | 70 std::string host_and_port() const; |
| 69 | 71 |
| 72 // TODO(willchan): Change to const HostPortPair& after refactoring |host_| and |
| 73 // |port_| here. |
| 74 HostPortPair host_port_pair() const; |
| 75 |
| 70 // Parse from an input with format: | 76 // Parse from an input with format: |
| 71 // [<scheme>"://"]<server>[":"<port>] | 77 // [<scheme>"://"]<server>[":"<port>] |
| 72 // | 78 // |
| 73 // Both <scheme> and <port> are optional. If <scheme> is omitted, it will be | 79 // Both <scheme> and <port> are optional. If <scheme> is omitted, it will be |
| 74 // assumed as |default_scheme|. If <port> is omitted, it will be assumed as | 80 // assumed as |default_scheme|. If <port> is omitted, it will be assumed as |
| 75 // the default port for the chosen scheme (80 for "http", 1080 for "socks"). | 81 // the default port for the chosen scheme (80 for "http", 1080 for "socks"). |
| 76 // | 82 // |
| 77 // If parsing fails the instance will be set to invalid. | 83 // If parsing fails the instance will be set to invalid. |
| 78 // | 84 // |
| 79 // Examples (for |default_scheme| = SCHEME_HTTP ): | 85 // Examples (for |default_scheme| = SCHEME_HTTP ): |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 std::string::const_iterator host_and_port_end); | 153 std::string::const_iterator host_and_port_end); |
| 148 | 154 |
| 149 Scheme scheme_; | 155 Scheme scheme_; |
| 150 std::string host_; | 156 std::string host_; |
| 151 int port_; | 157 int port_; |
| 152 }; | 158 }; |
| 153 | 159 |
| 154 } // namespace net | 160 } // namespace net |
| 155 | 161 |
| 156 #endif // NET_PROXY_PROXY_SERVER_H_ | 162 #endif // NET_PROXY_PROXY_SERVER_H_ |
| OLD | NEW |