SOCKS5H support for httpclient (#25070)

- Added support for SOCKS5h (h for proxy-side DNS resolving) to
httpclient
- Deprecated `auth` arguments for `newProxy` constructors, for auth to
be embedded in the url.

Unfortunately `http://example.com` is not currently reachable from
github CI, so the tests fail there for a few days already, I'm not sure
what can be done here.

(cherry picked from commit 161b321796)
This commit is contained in:
Yuriy Glukhov
2025-07-30 00:14:41 +02:00
committed by narimiran
parent 23b7372aa0
commit ca74debfbf
2 changed files with 132 additions and 46 deletions

View File

@@ -107,6 +107,13 @@ proc asyncTest() {.async.} =
# client = newAsyncHttpClient(proxy = newProxy("http://51.254.106.76:80/"))
# var resp = await client.request("https://github.com")
# echo resp
#
# SOCKS5H proxy test
# when manualTests:
# block:
# client = newAsyncHttpClient(proxy = newProxy("socks5h://user:blabla@127.0.0.1:9050"))
# var resp = await client.request("https://api.my-ip.io/v2/ip.txt")
# echo await resp.body
proc syncTest() =
var client = newHttpClient()