Re: wget, squid and auth option

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Thu, 16 Jul 1998 21:50:37 +0200

Juan Carlos Leon wrote:
>
> Is is possible to use wget while having squid compiled with the auth
> option? I would like to prefetch some sites but since squid asks for
> authentification wget is unable to retreive anything.

Yes. Add your own Proxy-Authorization header.

       --header=additional-header
              Define an additional header. You can define more
              than additional headers. Do not try to terminate
              the header with CR or LF.

or hack the source to add built in support for it, much in the same way
it currently supports normal HTTP authentication.

Here is a small perl hack that translates login and password to a
proxy-authorization header suiteable for use with the --header option to
wget (or another HTTP client which supports custom headers).

----------------
#!/usr/bin/perl
$login=$ARGV[0];
$password=$ARGV[1];
($cred=substr(pack("u","$login:$password"),1)) =~ tr# -_#A-Za-z0-9+#;
print "Proxy-Authorization: Basic $cred";
----------------

---
Henrik Nordström
Sparetime Squid Hacker
Received on Thu Jul 16 1998 - 13:09:54 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:41:08 MST