home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
- #
- # 2/22/94 Version 1.0, shell script version Paul Clark
- # 4/21/94 Version 1.1, multiple archives support Paul Clark
- # 4/22/94 Version 1.2, perl script Paul Clark
- # 8/05/94 Version 1.3, as aglimpse evolved Paul Clark
- #10/05/94 Version 1.4, with secure aglimpse Paul Clark
-
- # **** **** **** **** CONFIGURABLE VARIABLES **** **** **** ****
- $HTTPD_HOME="/usr1/paul/httpd" ;
-
- # **** **** **** **** NO CONFIGURATION NEEDED BELOW **** **** **** ****
-
- $_ = $ENV{'PATH_INFO'};
- if ( m|^/([0-9]+)(.*)$| ) {
- $script = $1;
- $path = $2;
- $path =~ s|"||g;
- } else {
- print "Content-type: text/html\n\n";
- print "<TITLE>Wrong file request $_</TITLE>\n";
- print "<H1>Wrong file request $_</H1>\n";
- print "Cannot determine numeric script ID from request $_\n";
- exit;
- }
-
- undef $indexdir;
- if (!open(AMGRCONF,"$HTTPD_HOME/wwwlib/amgr.cfg")) {
- $code = "$!";
- print "Content-type: text/html\n\n";
- print "<TITLE>Cannot open configuration file</TITLE>\n";
- print "<H1>Cannot open configuration file</H1>\n";
- print "Cannot open configuration file\n";
- print "$HTTPD_HOME/wwwlib/amgr.cfg : $code\n";
- exit;
- }
- line: while (<AMGRCONF>) {
- @_ = split(/\t/);
- if ( $_[3] eq $script ) {
- $indexdir=$_[0];
- $urlpath = $_[1];
- last line;
- }
- }
- $urlpath = "/$urlpath" if $urlpath !~ /^\//;
- close(AMGRCONF);
- if (!$indexdir) {
- print "Content-type: text/html\n\n";
- print "<TITLE>Script '$script' not found</TITLE>\n";
- print "<H1>Script '$script' not found</H1>\n";
- print "Cannot find script '$script' in the configuration file\n";
- print "$HTTPD_HOME/wwwlib/amgr.cfg.\n";
- exit;
- }
-
- $path = $indexdir . $path;
-
- if (-d $path) {
- print "Location: $urlpath\n\n";
- exit;
- }
-
- $ENV{'PATH_INFO'} = $path;
-
- if (!exec("$HTTPD_HOME/wwwlib/getfile $indexdir")) {
- $code = "$!";
- print "Content-type: text/html\n\n";
- print "<TITLE>Cannot execute getfile</TITLE>\n";
- print "<H1>Cannot execute getfile</H1>\n";
- print "Cannot execute $HTTPD_HOME/wwwlib/getfile : $code\n";
- exit;
- }
-