dakrone / clj-http

An idiomatic clojure http client wrapping the apache client. Officially supported version.
http://clojars.org/clj-http
MIT License
1.77k stars 408 forks source link

Handling of private proxies #616

Closed zackteo closed 2 years ago

zackteo commented 2 years ago

I have a private proxy like the following example from https://superuser.com/questions/1262861/what-is-a-proxy-username-and-password http://dshowerhandle:SuperSecretPassword@us.paidproxy.com

Am I right to say that private proxies are currently unsupported in clj-http?

Currently, when I try to do a request with

{:proxy-host "dshowerhandle:SuperSecretPassword@us.paidproxy.com"
 :proxy-port 8080}

I will get the following error

Unhandled java.net.UnknownHostException
   http://dshowerhandle:SuperSecretPassword@us.paidproxy.com: invalid IPv6 address

I know that this the proxy works as I can make a successful request with curl

dakrone commented 2 years ago

Something to try, have you tried specifying the proxy host using the java system property http.proxyHost and see if that one supports the authenticated proxy?

zackteo commented 2 years ago

Hi @dakrone thanks for your quick response. I discovered that proxies with passwords are actually supported: https://github.com/dakrone/clj-http/blob/5a5288319abab50141b8785625feca8de5a11dfc/src/clj_http/core.clj#L557

Was just previously confused since it wasn't mentioned in the README: https://github.com/dakrone/clj-http#proxies