6

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!

11

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"

2

Found the anwser myself after some more digging:

http://curl.haxx.se/docs/manual.html states

NOTE! According to the URL specification, HTTP URLs can not contain a user and password, so that style will not work when using curl via a proxy, even though curl allows it at other times. When using a proxy, you must use the -u style for user and password.

So I was doing it the wrong way :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.