home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / infoserv / www / cern / doc / www-talk.archive.Z / www-talk.archive / text0015.txt < prev    next >
Encoding:
Text File  |  1992-11-30  |  1.5 KB  |  55 lines

  1. What I say prototype, I mean just a little teeny tiny idea
  2. turned into a few lines of code.
  3.  
  4. This is a piece of perl that is a gateway between archie and
  5. WWW.  It should be set up to run as a server under inetd.  It
  6. takes incoming requests of the form
  7.     GET /nic.funet.fi/exact?wais
  8. and returns HTML formatted archie results back.  It depends on the
  9. C language Prospero archie client that you can get from (e.g.)
  10. ftp.cs.widener.edu.
  11.  
  12. My HTML is really bad but you get the idea, it should look somehow
  13. somewhat reasonable and something you can click on.
  14.  
  15. With a little bit of work any dbm file looks like it can be turned
  16. into a WWW queryable server along the same lines.
  17.  
  18. Take note that you are inviting truly perverse packet transport,
  19. with a query from one site resutling in hundreds of packets being
  20. shuttled all around the world ....
  21.  
  22. --Ed
  23.  
  24. #!/usr/local/bin/perl
  25.  
  26. # gateway from www to archie
  27. # this is the "brute force" kind of approach; a tidier solution
  28. # would speak the prospero protocols directly.
  29.  
  30. while (<>) {
  31.     if (m,^GET /(.*)/(.*)\?(.*)$,) {
  32.         $archie = $1;
  33.         $type = $2;
  34.         $query = $3;
  35.     } else {
  36.         exit 0; # XXX 
  37.     }
  38. #    print "$node $database $query \n";
  39.     if ($type eq 'exact') {
  40.         $arg = " -e ";
  41.     } else {
  42.         $arg = " -s ";
  43.     }
  44.     $archcmd = "archie -l -t " . $arg . " -h " . $archie . " " . $query ;
  45.     print "<title>archie $type search for $query on $archie </title>\n";
  46.     @result = `$archcmd`;
  47.     foreach (@result) {
  48.         ($time, $size, $host, $file) = split;
  49.         print "<a href=file://anonymous@$host:$file>\n";
  50.         print "$_</a>\n";
  51.     }
  52. }
  53.  
  54.  
  55.