Quick answer

In curl, Python requests (urllib3), and libcurl-based tools, socks5:// resolves the target domain's DNS locally on your machine and only sends the raw IP to the proxy — leaking every hostname you visit to your local ISP and breaking geo-DNS routing. socks5h:// (--socks5-hostname) sends the hostname string inside the SOCKS5 tunnel (ATYP = 0x03) so the exit proxy resolves DNS in the target country.

Key takeaways
01

The h stands for hostname (ATYP 0x03). Without the h, curl runs getaddrinfo() locally (ATYP 0x01 IPv4).

02

Geo-blocked CDNs check DNS resolver location too. Resolving DNS in London while exiting a proxy in Tokyo often routes you to the wrong CDN edge or triggers geo-mismatch flags.

03

Applies identically to curl and Python requests. Note: Python httpx and Chromium (Playwright) already resolve remotely on socks5:// by default.

Inside man curl, --socks5 and --socks5-hostname sit two paragraphs apart among 400+ CLI flags — yet mixing them up is the #1 reason geo-testing scripts leak local ISP DNS queries.

Exact side-by-side behavior

Scheme / FlagWhere DNS ResolvesWire Frame Sent to ProxyGeo-CDN Safe?
socks5://host:1080 (--socks5)Locally on your OS / ISPATYP=0x01 (4-byte IPv4)No — leaks local DNS
!socks5h://host:1080 (--socks5-hostname)Remotely by proxy exitATYP=0x03 (domain string)Yes — exit-country DNS

Underlined = best value in that row. RFC 1928 SOCKS5 address-type (ATYP) wire behavior.

Copy-paste examples (cURL & Python requests)

1. cURL (always prefer socks5h://)

curl --proxy 'socks5h://YOUR_KEY:[email protected]:1080'   'https://cloudflare.com/cdn-cgi/trace'

2. Python requests (pip install 'requests[socks]')

import requests

# Notice socks5h:// (NOT socks5://) — forces remote DNS resolution
proxy = "socks5h://YOUR_KEY:[email protected]:1080"
r = requests.get("https://api.ipify.org?format=json", proxies={"http": proxy, "https": proxy}, timeout=15)
print(r.json())

Want to verify your SOCKS5 string's exit country and latency from Dallas, London, and Amsterdam? Test it in our free Proxy Checker or explore our non-expiring SOCKS5 Proxies ($0.75/GB datacenter, $1.50/GB residential).