summaryrefslogtreecommitdiffstats
path: root/net/socket/socks5_client_socket.h
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 00:24:37 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 00:24:37 +0000
commitf209dba88c91b0461dc5acd02af0b3685213938c (patch)
tree00fd853220b8ad787dc9134f7494da1b8c30af6f /net/socket/socks5_client_socket.h
parenta784b84a86ec0103b9af04772b573a91684a8a73 (diff)
downloadchromium_src-f209dba88c91b0461dc5acd02af0b3685213938c.zip
chromium_src-f209dba88c91b0461dc5acd02af0b3685213938c.tar.gz
chromium_src-f209dba88c91b0461dc5acd02af0b3685213938c.tar.bz2
When talking to a SOCKS v5 proxy, default to sending addresses as raw domains rather than IP addresses.
Before, we would default to client-side DNS resolution (sending IP addresses to the proxy) for both v4 and v5. However if you are using a v5 server, it is most likely that you want to do the resolves on the proxy-side. And in fact if you are using a SOCKS 5 proxy to anonymize your browsing, you definitely don't want that as the default policy. Embedders of the network stack can select the alternate policy by passing a non-NULL Host resolver into SOCKS5ClientSocket. BUG=29914 TEST=HttpNetworkTransactionTest.SOCKS5_HTTP_GET, HttpNetworkTransactionTest.SOCKS5_SSL_GET Review URL: http://codereview.chromium.org/507033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socks5_client_socket.h')
-rw-r--r--net/socket/socks5_client_socket.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/net/socket/socks5_client_socket.h b/net/socket/socks5_client_socket.h
index a5db645..9a05f4a 100644
--- a/net/socket/socks5_client_socket.h
+++ b/net/socket/socks5_client_socket.h
@@ -31,6 +31,21 @@ class SOCKS5ClientSocket : public ClientSocket {
//
// |req_info| contains the hostname and port to which the socket above will
// communicate to via the SOCKS layer.
+ //
+ // SOCKS5 supports three modes of specifying connection endpoints:
+ // (1) as an IPv4 address.
+ // (2) as an IPv6 address.
+ // (3) as a hostname string.
+ //
+ // To select mode (3), pass NULL for |host_resolver|.
+ //
+ // Otherwise if a non-NULL |host_resolver| is given, Connect() will first
+ // try to resolve the hostname using |host_resolver|, and pass that
+ // resolved address to the proxy server. If the resolve failed, Connect()
+ // will fall-back to mode (3) and simply send the unresolved hosname string
+ // to the SOCKS v5 proxy server.
+ //
+ // Passing NULL for |host_resolver| is the recommended default.
SOCKS5ClientSocket(ClientSocket* transport_socket,
const HostResolver::RequestInfo& req_info,
HostResolver* host_resolver);
@@ -142,8 +157,10 @@ class SOCKS5ClientSocket : public ClientSocket {
size_t read_header_size;
- // Used to resolve the hostname to which the SOCKS proxy will connect.
- SingleRequestHostResolver host_resolver_;
+ // If non-NULL, we will use this host resolver to resolve DNS client-side
+ // (and fall back to proxy-side resolving if it fails).
+ // Otherwise, we will do proxy-side DNS resolving.
+ scoped_ptr<SingleRequestHostResolver> host_resolver_;
AddressList addresses_;
HostResolver::RequestInfo host_request_info_;