[plug] Any other Web suckers like wget?

Matt Kemner zombie at networx.net.au
Fri Mar 19 13:26:18 WST 1999


On Fri, 19 Mar 1999 steve at rumah.iinet.net.au wrote:

> Hi,
>     I've been playing a little with wget, and want to disable the ":80"
> that it appends to urls (the web server I want to bleed dry
> (contact.net.au) returns its own manual when port 80 is specified.  Even
> to a browser.

Use the source, luke.

The problem is here not so much the :80 it appends to the URL as the :80
it appends to the Host: header it sends to the webserver.. contact.net.au
have their web server misconfigured, but that's beside the point.
To disable the :80 on the Host header, just take it out.

I searched for "Host:" in wget's source and found it referenced in http.c
which is where it sends the GET, the User-Agent, the Host: and the Accept:
headers in one line.  If you look in the source you will see it sends
%s %s HTTP/1.0\r\nUser-Agent: %s\r\nHost: %s:%d\r\nAccept: %s\r\n etc 
then on the next line it fills in the %s and %d blanks with, in order,
command, path, useragent, remhost, remport, HTTP_ACCEPT, etc.

so all you need to do to prevent it from sending :80 is to change
Host: %s:%d\r\n to Host: %s\r\n and then change
"useragent, remhost, remport, HTTP_ACCEPT"
  to
"useragent, remhost, HTTP_ACCEPT"

Then recompile, and use this new wget for your websuck

Of course it means it won't send the port even if the port is not :80, so
it may stop working with other webservers, so the best thing would be to
code in an if-statement that sets the port if it's not 80, then send a
patch to the author.  My C programming skills are not that advanced
however, so I'm happy doing the above and having 2 wget binaries - the
vanilla one, and the hacked one.

If you want a copy of the hacked binary, let me know and I'll stick it on
my website.

 - Matt



More information about the plug mailing list