Using curl to access basic auth protected website via proxy (polipo)

authenticationcurlpolipoPROXY

I am trying to download a file protected via basic auth:

curl "http://User:Pass@example.com/blub/bla.bin"

This is working fine.

As soon as I tell curl to use my locally installed polipo it fails:

$ http_proxy="http://127.0.0.1:8123" curl "http://XXXXX:Pass@example.com/blub/bla.bin"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>Proxy error: 504 Host XXXXX lookup failed: Host not found.</title>
</head><body>
<h1>504 Host XXXXX lookup failed: Host not found</h1>
<p>The following error occurred while trying to access <strong>http://XXXXX:Pass@example.com/blub/bla.bin</strong>:<br><br>
<strong>504 Host XXXXX lookup failed: Host not found</strong></p>
<hr>Generated Wed, 12 Mar 2014 22:46:10 CET by Polipo on <em>hostname:8123</em>.
</body></html>
$

Is this caused due to an error in Polipo or curl? (Or am I doing it wrong?)

EDIT: http_proxy="http://127.0.0.1:8123" curl -u XXXXX:Pass "http://example.com/blub/bla.bin" is working fine.
Thanks!

Best Answer

Not necessary to use http_proxy, try this:

curl -x PROXY-SERVER:PORT -U USER:PASS URL

curl -x 127.0.0.1:8123 -U XXXXX:Pass "http://example.com/blub/bla.bin"

Related Question