Why resolve the dns locally when using a socks5 proxy
Date: Fri, 16 Aug 2019 01:19:50 +0800
In the source code /lib/socks.c, there's the following line:
bool socks5_resolve_local =
(conn->socks_proxy.proxytype == CURLPROXY_SOCKS5) ? TRUE : FALSE;
It define's a boolean variable socks5_resolve_local, which is a flag to
decide whether to resolve dns locally. Apparently when the proxy is a
socks5 proxy, it would be true.
But the locally resolved IP address may not be accessible for the socks5
proxy server, which lead to an error message like:
curl: (7) Failed to receive SOCKS5 connect request ack.
Therefore, I wonder why does the variable exists. How about to remove it to
enable remote dns resolve since the socks5 protocol supports domain name as
its address type. See https://tools.ietf.org/html/rfc1928.
What's more, browsers like firefox provides an configuration entry
`network.proxy.socks_remote_dns` to enable socks5 remote resolving.
As far as I'm concerned, it's better for curl to have this feature.