Re: patch to exec from httpd

Eelco van Asperen (evas@cs.few.eur.nl)
Fri, 26 Feb 93 19:40:33 +0100


> I seem to remember something about a patch to httpd to allow mapping
> onto a command, rather than a file, but I can't remember where. Am I
> hallucinating, or can someone let me know where this thing is?

I have added some code to httpd to allow a filter to be run when
a file with a certain extension is requested.
The patches are on ftp.cs.few.eur.nl, file pub/www/Daemon0.9b.patch.
Here's the start of that file;

The patches add a generic conversion facility to the HTTP daemon.
The syntax of the httpd.conf file has been extended to include a
'convert' entry. Below is a piece of our httpd.conf file:

convert info /usr/pkg/www/bin/info2html
convert man /usr/pkg/www/bin/man2html

'info' and 'man' are the file extensions and '/usr/pkg/www/bin/...'
are the filters that should convert the document to HTML.
The filter is called with the document name from the reference
as its only argument.

Note that the daemon code has the following extensions hard coded
so they can not be used with this facility:
.html .rtf .tar .hqx .Z

If the daemon has been updated with this code and the filters
have been installed in the right directory, references like
'http://host/man/csh.man' or 'http://host/info/gcc.info' should
trigger the execution of the appropriate script and convert the
requested document to HTML format.

It is handy to create some mappings for the new document types
so references don't depend on the exact location of the documents
in your filesystem;

map /info/* /usr/pkg/gnu/info/*
#
# map various man-page categories to directories:
#
map /man/gnu/* /usr/pkg/gnu/man/*
map /man/lang/* /usr/lang/man/*
map /man/local/* /usr/local/man/*
map /man/openwin/* /usr/pkg/openwin3.0/man/*
map /man/newsprint/* /usr/pkg/newsprint1.0/man/*
map /man/X/* /usr/local/X11R5/man/*
map /man/* /usr/man/*

The info2html and man2html filters are in the same directory
on our ftp server as this patch (host ftp.cs.few.eur.nl, directory
pub/www).

The sample conversion filters are written in Perl so you'll need the
perl program (available from archive sites all over the world);
make sure that the first line of the filters is correct
(/usr/local/bin/perl may not be the location of the perl
binary at your site).

Eelco van Asperen. | Erasmus University Rotterdam
-----------------------------| Department of Computer Science, room H4-32
internet: evas@cs.few.eur.nl | PObox 1738, 3000 DR Rotterdam, The Netherlands
-----------------------------------------------------------------------------