I'm running a ubuntu 10.04 i386 desktop edition. I have configured the http proxy via the http_proxy variable. When I use wget I get a connection refused but, curl, apt-get etc. work just fine. Any idea what I'm missing here?

$ echo $http_proxy
http://10.0.0.42:8080/
$ export HTTP_PROXY=$http_proxy
$ wget --proxy=on http://www.google.com
--2010-06-24 18:56:53--  http://www.google.com/
Resolving www.google.com... 74.125.95.106, 74.125.95.147, 74.125.95.99, ...
Connecting to www.google.com|74.125.95.106|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.147|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.99|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.103|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.104|:80... failed: Connection refused.
Connecting to www.google.com|74.125.95.105|:80... failed: Connection refused.
$ curl http://www.google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.co.in/">here</A>.
</BODY></HTML>
$ 
link|improve this question
feedback

4 Answers

I've found that some programs use the environment variable http_proxy (lower case), while others use HTTP_PROXY (upper case). Because it's quicker than looking up which program uses which variable, I tend to set 'em both.

link|improve this answer
feedback

After setting http_proxy like so:

export http_proxy="http://proxy.example.com:8080"

Use wget with this flag:

--proxy=on

You can use

--proxy-username="username" --proxy-passwd="password"

to set proxy username and password where required.

link|improve this answer
feedback
up vote 1 down vote accepted

Thanks for your help guys. I found the solution with some help from the ever helpful folks at #ubuntu. The problem turned out to be the no_proxy that was set to localhost once I unset it wget worked fine

link|improve this answer
feedback

for curl you need to us -L option

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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