Open ghost opened 3 years ago
The connection
page, which lives underneath http-client-tls
, already supports SOCKS proxies. You can configure it here:
If I'm not mistaken, using that will automatically use SOCKS proxying for both TLS and non-TLS connections.
Thanks for the swift reply. I'm going to give that a shot.
I'm trying to debug this.
https_proxy='socks5://localhost:9150'
newTlsManager
uses the proxy.newTlsManagerWith tlsManagerSettings
doesn't use proxy.I suppose this is because newTlsManagerWith
resets managerTlsProxyConnection
after it is set to use SOCKS proxy:
https://github.com/snoyberg/http-client/blob/master/http-client-tls/Network/HTTP/Client/TLS.hs#L214
Also, it's very hard to debug the library, because
responseOpen
:(manager, req0) <- getModifiedRequestManager manager' inputReq
go manager (redirectCount req0) req0
...
go manager0 count req' =
...
getModifiedRequestManager manager0 req
It is working as well for me @snoyberg
I would find SOCKS4 proxy support useful in http-client. SSH provides an easy way to set up a SOCKS4 proxy on your local machine to a remote SSH server. HTTP requests could then be proxied through the remote SSH server.
I have been considering implementing SOCKS4 support for http-client. The
Proxy
type, which currently only represents HTTP proxies, would be replaced with a choice of either HTTP Proxy or SOCKS4.Would this feature be useful and accepted into the code base? Is there already a way to do this in a custom way? I thought that
withConnection
might be useful for implementing the initial SOCKS4 connection setup, but it seems thatconnectionRead
does not block.Any suggestions would be appreciated.