[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Wrapping web browser to use a proxy



Howdy folks,

what do you think about enclosing the web browsers to use a proxy for
various services?  This would make it a lot easier for system
administrators to make the installed software *use* the proxies.

On my systems I have a file /etc/www.conf that looks like

--------------------------------------------------------------------
# /etc/www.conf - Configuration file for all WWW browser and tools
#

port=8086

if [ "$client" = "httpget" ]; then
  http_proxy="http://escher.North.DE:${port}/";
else
  http_proxy="http://proxy.Infodrom.North.DE:${port}/";
#  http_proxy="http://escher.North.DE:3128/";
fi
ftp_proxy="http://proxy.Infodrom.North.DE:${port}/";
gopher_proxy="http://proxy.Infodrom.North.DE:${port}/";
wais_proxy="http://proxy.Infodrom.North.DE:${port}/";
no_proxy="uni-oldenburg.de north.de"
--------------------------------------------------------------------

Lynx, Mosaic etc. are not called by their binary name.  Instead
/usr/bin/lynx and /usr/X11/bin/xmosaic are small shell scripts that
evaluate this file and set various variables to make these programs
aware of the proxies.  After that the "real" browser is executed.

The above file could be easyly included in a script using soure or .
All such scripts have to set a `client' variable to determine which
client is run.  This way you can use different proxies for different
clients.

If the particular client doesn't understand this sort but needs
different variables that could be handled in the wrapper script.

The script for Lynx could look like:

--------------------------------------------------------------------
#! /bin/sh
#
# Wrapper around any WWW browser or related tool
#
conf=/etc/www.conf

client=lynx
bin=/usr/bin/lynx.bin
name='Lynx 2.8'

if [ "$1" = '-nocache' -o "$1" = '--nocache' ] ; then
  shift
  if [ -n "$name" ]; then echo "$name (no cache)"; fi
else
  if [ -f $conf ]; then
    . $conf
    export http_proxy ftp_proxy gopher_proxy wais_proxy no_proxy
    if [ -n "$name" ]; then echo "$name ($http_proxy)"; fi
  fi
fi

exec ${bin} $*
--------------------------------------------------------------------

I'd be very happy if this mechanism would be included into Debian
GNU/Linux wherever is is possible.  This means lynx, mosaic, chimera,
wget etc.

I'd suggest the configuration file would be included in the
debianutils package.

If we decide to use such a mechanism we should consider a policy
change that web browsers must use this if it is possible (I fear that
it's impossible for Netscape, so I'm careful with my must/should/can).

Best regards,

	Joey

-- 
  / Martin Schulze  *  joey@infodrom.north.de  *  26129 Oldenburg /
 /                              No question is too silly to ask, /
/    but, of course, some are too silly to answer  -- perl book /

Attachment: pgpAzW5R_39un.pgp
Description: PGP signature


Reply to: