How to set http proxy address for wget under windows?

11

2

If ran without parameters my wget prints:

D:\>wget
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = c:/progra~1/wget/etc/wgetrc
D:\Apps\Util\wget: missing URL
Usage: D:\Apps\Util\wget [OPTION]... [URL]...

Try `D:\Apps\Util\wget --help' for more options.

This probably means, that is looks for file wgetrc in c:/progra~1/wget/etc/wgetrc. Unfortunately, this location is unavailable for non-root programs. I was thinking I can modify SYSTEM_WGETRC or syswgetrc environment variables, but this looks having no effect

D:\>echo %SYSTEM_WGETRC%
d:\apps\util\wgetrc

D:\>echo %syswgetrc%
D:\APPS\Util\wgetrc

Suzan Cioc

Posted 2013-01-01T16:07:56.607

Reputation: 2 103

Ouch that is so darn weird. Why do you get forward slashes c:/ ? It should be C:\ – barlop – 2013-01-01T19:49:07.893

also funny that your wget tells you about wgetrc, mine doesn't. Maybe we have some setting different. But what version of wget do you have? – barlop – 2013-01-01T20:04:08.330

Answers

10

wget --help doesn't tell you much. For more detail you can check the online wget manual Or man wget (they are different things, it's often worth checking each)

In short, here's an example

C:\sdf>wget -e http_proxy=127.0.0.1:8118 www.google.com

and another

C:\sdf>set http_proxy=127.0.0.1:8118
C:\sdf>wget www.google.com

The manual mentions wgetrc commands. You see some things about http proxies listed there.

6.3 Wgetrc Commands

  • http_proxy = string
    Use string as http proxy, instead of the one specified in environment.
  • https_proxy = string
    Use string as https proxy, instead of the one specified in environment.

8.1 Proxies

Wget supports proxies for both http and ftp retrievals. The standard way to specify proxy location, which Wget recognizes, is using the following environment variables:

  • http_proxy
  • https_proxy
    If set, the http_proxy and https_proxy variables should contain the urls of the proxies for http and https connections respectively.

added

Regarding the wget man page and the "wget manual".

Man pages at the command line are up to date, but the manual(a different entity from manpage), is not always an up to date wget version. As of writing(sept 2015) it is. http://www.gnu.org/software/wget/manual/wget.html You can see the version at the top and check if it's the latest http://ftp.gnu.org/gnu/wget/ it shows dates too. (You see on archive.org that in e.g. Nov 2013 the gnu manual was very out of date. In Nov 2013 even March 2014, they were still showing wget 1.13.4 which was from 2011)

For the manpage, if you're checking from command line then it must be the version you're using so you can be fine there by just making sure your command is up to date / updating it. You may want to check that the/any online source you are using is showing the latest man page. This one seems fine https://www.kernel.org/doc/man-pages/ links to http://man7.org/linux/man-pages/man1/wget.1.html You can also check the version there against the ftp link to make sure it's the latest version.

barlop

Posted 2013-01-01T16:07:56.607

Reputation: 18 677

In Dec 2013, it was the case that man wget had a more recent version than the webpage. e.g. --content-on-error was on that 2013 man wget page, but not on the wget online manual that lists the options. So the webpage isn't always up to date. Though as mentioned in my answer, as of Sept 2015, the webpage is up to date. – barlop – 2015-09-22T07:03:56.843

1

I think you just want to set the HTTP_PROXY environment variable.

From : http://www.gnu.org/software/wget/manual/html_node/Proxies.html:

Wget supports proxies for both http and ftp retrievals. The standard way to specify proxy location, which Wget recognizes, is using the following environment variables:

http_proxy
https_proxy

If set, the http_proxy and https_proxy variables should contain the urls of the proxies for http and https connections respectively.

ckhan

Posted 2013-01-01T16:07:56.607

Reputation: 5 689

1

barlop's answer in general is fine, but a few comments:

on the dos/windows command line or batch file, you specify

set http[s]_proxy=http[s]://proxyserver:port/

then wget works fine.

it will usually also take your windows single sign-on credentials if you are in a company network with NTLM authentication against the proxy (no need to hassle around with domain - backslash - user)

steinweb

Posted 2013-01-01T16:07:56.607

Reputation: 26