0

If I run:

echo $http_proxy

It output:

http://user:pass@host:port

But when I run:

wget www.google.com

It output:

Resolviendo www.google.com... 209.85.195.104
Caching www.google.com => 209.85.195.104
Conectando a www.google.com|209.85.195.104|:80... Closed fd 3
falló: Expiró el tiempo de conexión.
Releasing 0x088293a8 (new refcount 1).
Reintentando.

--2010-07-07 19:40:00--  (intento: 2)  http://www.google.com/
Found www.google.com in host_name_addresses_map (0x88293a8)
Conectando a www.google.com|209.85.195.104|:80...

In English:

Resolving www.google.com... 209.85.195.104
Caching www.google.com => 209.85.195.104
conecting to www.google.com|209.85.195.104|:80... Closed fd 3
fail: conection time has expired.
Releasing 0x088293a8 (new refcount 1).
retrying.
...

What I am doing wrong?

NOTE: the https_proxy and ftp_proxy have the same value. And I already try to modify /etc/wgetrc and reinit without success.

2
  • Can you elucidate what's in the [...] error there? Are you seeing [proxyhost|ip_address|:port], as expected with $http_proxy set correctly? Could you share an obfuscated version of wget --debug www.google.com?
    – medina
    Jul 7, 2010 at 21:07
  • ok, but it's Spanish
    – damian
    Jul 7, 2010 at 21:42

5 Answers 5

1

Thanks for the debug logs.

So you're clearly not using up the env proxy settings you expect based on that output.

See http://www.gnu.org/software/wget/manual/wget.html#Proxies for some alternate methods of configuring the proxy settings.

It's not clear if you're in some kind of controlled environment, but it's also possible that the wget you're calling has been modified in some how -- perhaps there's a wrapper script that's stripping out the environment or disabling the proxy settings from being used (--no-proxy). Does file $(which wget) show it's an executable?

1
  • file $(which wget) outputs: /usr/bin/wget: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
    – damian
    Jul 8, 2010 at 13:30
0

Is this Ubuntu? See the workaround at https://bugs.launchpad.net/ubuntu/+source/wget/+bug/585766 .

Also, you might need to set 'proxy = on' in your .wgetrc , in addition to setting the http_proxy environment variable. I think that is vaguely suggested at http://www.gnu.org/software/wget/manual/wget.html#Proxies .

0

Also, try to set $HTTP_PROXY instead.

0

Did you define http_proxy in /etc/wgetrc or ~/.wgetrc? Wget doesn't seem to read the environment variable, but it worked for me when I defined it in one of those files.

EDIT: I don't need to modify wgetrc if I set http_proxy in ~/.bashrc and remove no_proxy from /etc/environment.

0

In order for variables defined in your shell to be passed to subprocesses, they have to be exported. Failing to export them can cause the issue you describe. Here's an example from my own terminal:

First, I try to download the page, and discover it's not using my proxy.

sh-3.2$ wget serverfault.com
--2016-11-03 18:46:15--  http://serverfault.com/
Resolving serverfault.com... 151.101.65.69, 151.101.129.69, 151.101.193.69, ...
Connecting to serverfault.com|151.101.65.69|:80... ^C

I discover the error of my ways, and define the environment variable.

sh-3.2$ http_proxy="http://proxy.example.com:80/"
sh-3.2$ echo $http_proxy
http://proxy.example.com:80/
sh-3.2$ wget serverfault.com
--2016-11-03 18:46:53--  http://serverfault.com/
Resolving serverfault.com... 151.101.65.69, 151.101.129.69, 151.101.193.69, ...
Connecting to serverfault.com|151.101.65.69|:80... ^C

Unfortunately, it still doesn't work. The problem is that I didn't export the variable after I defined it, so subprocesses can't see it.

sh-3.2$ env | grep http_proxy
sh-3.2$ export http_proxy
sh-3.2$ env | grep http_proxy
http_proxy=http://proxy.example.com:80/

wget should now attempt to use my proxy.

sh-3.2$ wget serverfault.com
--2016-11-03 18:48:30--  http://serverfault.com/
Resolving proxy.example.com... failed: nodename nor servname provided, or not known.
wget: unable to resolve host address 'proxy.example.com'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .