A bit of fun and games and I’ve managed to configure privoxy to automatically add in the headers to work with the authenticating proxy here at Monash. No more 407 errors for me!

HTTP’s Basic Authentication is quite basic. With a username of username and a password of password, a single header is added to every HTTP request, of the form:

Proxy-Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=\r\n

The username and password are base64 encoded, to find your string, something along the lines of:

echo -n username:password | mencode

Should do the trick. I’ve used that before, but couldn’t locate mencode so the following perl snippet works.

use MIME::Base64;

print MIME::Base64::encode_base64($ARGV[1]);

Locate your privoxy config files, I’m not really sure where in them to put it, but you’ll need to add the following config line:

{+add-header{Proxy-Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=\r\n}}

As a result of this I’ve now got tla working, after setting http_proxy=http://localhost:8118/. Presumably other programs that are proxy aware, but can’t handle proxy authentication, can be made to work in a similar fashion.