prototype of www-prospero-archie interface

Edward Vielmetti <emv@msen.com>
Message-id: <m0kjoAF-000HftC@heifetz.msen.com>
To: www-talk@nxoc01.cern.ch
Cc: archie-maint@cc.mcgill.ca, prospero@isi.edu
Subject: prototype of www-prospero-archie interface
Date: Wed, 20 Nov 91 04:24:09 -0500
From: Edward Vielmetti <emv@msen.com>
What I say prototype, I mean just a little teeny tiny idea
turned into a few lines of code.

This is a piece of perl that is a gateway between archie and
WWW.  It should be set up to run as a server under inetd.  It
takes incoming requests of the form
        GET /nic.funet.fi/exact?wais
and returns HTML formatted archie results back.  It depends on the
C language Prospero archie client that you can get from (e.g.)
ftp.cs.widener.edu.

My HTML is really bad but you get the idea, it should look somehow
somewhat reasonable and something you can click on.

With a little bit of work any dbm file looks like it can be turned
into a WWW queryable server along the same lines.

Take note that you are inviting truly perverse packet transport,
with a query from one site resutling in hundreds of packets being
shuttled all around the world ....

--Ed

#!/usr/local/bin/perl

# gateway from www to archie
# this is the "brute force" kind of approach; a tidier solution
# would speak the prospero protocols directly.

while (<>) {
        if (m,^GET /(.*)/(.*)\?(.*)$,) {
                $archie = $1;
                $type = $2;
                $query = $3;
        } else {
                exit 0; # XXX 
        }
#       print "$node $database $query \n";
        if ($type eq 'exact') {
                $arg = " -e ";
        } else {
                $arg = " -s ";
        }
        $archcmd = "archie -l -t " . $arg . " -h " . $archie . " " . $query ;
        print "<title>archie $type search for $query on $archie </title>\n";
        @result = `$archcmd`;
        foreach (@result) {
                ($time, $size, $host, $file) = split;
                print "<a href=file://anonymous@$host:$file>\n";
                print "$_</a>\n";
        }
}