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
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 1106757..53481ba 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -3366,8 +3366,16 @@
const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 };
const char kSOCKS5GreetResponse[] = { 0x05, 0x00 };
- const char kSOCKS5OkRequest[] =
- { 0x05, 0x01, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
+ const char kSOCKS5OkRequest[] = {
+ 0x05, // Version
+ 0x01, // Command (CONNECT)
+ 0x00, // Reserved.
+ 0x03, // Address type (DOMAINNAME).
+ 0x0E, // Length of domain (14)
+ // Domain string:
+ 'w', 'w', 'w', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm',
+ 0x00, 0x50, // 16-bit port (80)
+ };
const char kSOCKS5OkResponse[] =
{ 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
@@ -3422,8 +3430,17 @@
const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 };
const char kSOCKS5GreetResponse[] = { 0x05, 0x00 };
- const unsigned char kSOCKS5OkRequest[] =
- { 0x05, 0x01, 0x00, 0x01, 127, 0, 0, 1, 0x01, 0xBB };
+ const unsigned char kSOCKS5OkRequest[] = {
+ 0x05, // Version
+ 0x01, // Command (CONNECT)
+ 0x00, // Reserved.
+ 0x03, // Address type (DOMAINNAME).
+ 0x0E, // Length of domain (14)
+ // Domain string:
+ 'w', 'w', 'w', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm',
+ 0x01, 0xBB, // 16-bit port (443)
+ };
+
const char kSOCKS5OkResponse[] =
{ 0x05, 0x00, 0x00, 0x01, 0, 0, 0, 0, 0x00, 0x00 };