| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // Gets the port portion of the proxy server. | 58 // Gets the port portion of the proxy server. |
| 59 int port() const; | 59 int port() const; |
| 60 | 60 |
| 61 // Returns the <host>":"<port> string for the proxy server. | 61 // Returns the <host>":"<port> string for the proxy server. |
| 62 std::string host_and_port() const; | 62 std::string host_and_port() const; |
| 63 | 63 |
| 64 // Parse from an input with format: | 64 // Parse from an input with format: |
| 65 // [<scheme>"://"]<server>[":"<port>] | 65 // [<scheme>"://"]<server>[":"<port>] |
| 66 // | 66 // |
| 67 // Both <scheme> and <port> are optional. If <scheme> is omitted, it will | 67 // Both <scheme> and <port> are optional. If <scheme> is omitted, it will be |
| 68 // be assumed as "http". If <port> is omitted, it will be assumed as | 68 // assumed as |default_scheme|. If <port> is omitted, it will be assumed as |
| 69 // the default port for the chosen scheme (80 for "http", 1080 for "socks"). | 69 // the default port for the chosen scheme (80 for "http", 1080 for "socks"). |
| 70 // | 70 // |
| 71 // If parsing fails the instance will be set to invalid. | 71 // If parsing fails the instance will be set to invalid. |
| 72 // | 72 // |
| 73 // Examples: | 73 // Examples (for |default_scheme| = SCHEME_HTTP ): |
| 74 // "foopy" {scheme=HTTP, host="foopy", port=80} | 74 // "foopy" {scheme=HTTP, host="foopy", port=80} |
| 75 // "socks4://foopy" {scheme=SOCKS4, host="foopy", port=1080} | 75 // "socks4://foopy" {scheme=SOCKS4, host="foopy", port=1080} |
| 76 // "socks5://foopy" {scheme=SOCKS5, host="foopy", port=1080} | 76 // "socks5://foopy" {scheme=SOCKS5, host="foopy", port=1080} |
| 77 // "http://foopy:17" {scheme=HTTP, host="foopy", port=17} | 77 // "http://foopy:17" {scheme=HTTP, host="foopy", port=17} |
| 78 // "direct://" {scheme=DIRECT} | 78 // "direct://" {scheme=DIRECT} |
| 79 // "foopy:X" INVALID -- bad port. | 79 // "foopy:X" INVALID -- bad port. |
| 80 static ProxyServer FromURI(const std::string& uri); | 80 static ProxyServer FromURI(const std::string& uri, Scheme default_scheme); |
| 81 static ProxyServer FromURI(std::string::const_iterator uri_begin, | 81 static ProxyServer FromURI(std::string::const_iterator uri_begin, |
| 82 std::string::const_iterator uri_end); | 82 std::string::const_iterator uri_end, |
| 83 Scheme default_scheme); |
| 83 | 84 |
| 84 // Format as a URI string. This does the reverse of FromURI. | 85 // Format as a URI string. This does the reverse of FromURI. |
| 85 std::string ToURI() const; | 86 std::string ToURI() const; |
| 86 | 87 |
| 87 // Parses from a PAC string result. | 88 // Parses from a PAC string result. |
| 88 // | 89 // |
| 89 // If <port> is omitted, it will be assumed as the default port for the | 90 // If <port> is omitted, it will be assumed as the default port for the |
| 90 // chosen scheme (80 for "http", 1080 for "socks"). | 91 // chosen scheme (80 for "http", 1080 for "socks"). |
| 91 // | 92 // |
| 92 // If parsing fails the instance will be set to invalid. | 93 // If parsing fails the instance will be set to invalid. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 122 std::string::const_iterator host_and_port_end); | 123 std::string::const_iterator host_and_port_end); |
| 123 | 124 |
| 124 Scheme scheme_; | 125 Scheme scheme_; |
| 125 std::string host_; | 126 std::string host_; |
| 126 int port_; | 127 int port_; |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 } // namespace net | 130 } // namespace net |
| 130 | 131 |
| 131 #endif // NET_PROXY_PROXY_SERVER_H_ | 132 #endif // NET_PROXY_PROXY_SERVER_H_ |
| OLD | NEW |