curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Why resolve the dns locally when using a socks5 proxy

From: Qiying Wang via curl-users <>
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

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.

Received on 2019-08-15