Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

curl "http://User:[email protected]/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:[email protected]/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:[email protected]/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!

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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 :)

share|improve this answer

not necessary 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"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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