Bucktooth: Proxy-ability support
--------------------------------

Proxy-ability doesn't mean that Bucktooth can act as a proxy per se, but
rather that it can be called by a script (such as the Floodgap Public Gopher
Proxy) as a dependent program, as well as act as a server program. This
feature is supported in 0.1-pr4 and up.

This is set up on Floodgap to allow the Public Proxy to call Bucktooth
directly rather than invoke the overhead of the server opening up sockets to
itself. It also allows Bucktooth to do proper logging of client addresses and
requests. You might use this to have your Web CGIs, for example, call your
local Bucktooth for requests to avoid replicating data without having to use
a formal proxy.

To run as a sub-program, pass the -isproxy option, and one or more of the
following options:

-proxy=[hexencoded request]
This contains the actual Gopher request (i.e., the selector string that the
"client" is sending -- see the RFC). The request must be hex-encoded to help
hide weird things like tab characters, which might be eaten by shells or Perl
or your scripting language of choice. In Perl, it can be trivially done like
so:

	$hexrequest = unpack("H".length($request)*2, $request);

-proxyip=[remote IP address]
If $ENV{'REMOTE_ADDR'} is not available, Bucktooth logs this as the IP
address. Note: if REMOTE_ADDR *is* available, it overrides this option.
Thus, if you're in a CGI, or a HTTPi executable, this option is meaningless
unless you blow away the environment variable.

-proxyhost=[remote FQDN]
If $ENV{'REMOTE_HOST'} is not available, Bucktooth logs this as the hostname,
falling on IP address if neither are provided. Same issues apply as above.

-proxyport=[remote port]
If $ENV{'REMOTE_PORT'} is not available, Bucktooth uses this as the remote
port number. Same issues apply as above.

<end of options>

Any data the server returns is emitted on standard output. In Perl, you
might capture it like this:

	open(GOPHERD, "/usr/sbin/buckd -isproxy -proxy=$hexrequest |");

and then read from GOPHERD filehandle. Proxy-ability is experimental and is
under expansion.