#!/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     **** **** **** ****
$GLIMPSEHTTP_HOME="/usr2/local/glimpsehttp2" ;

# **** **** **** **** NO CONFIGURATION NEEDED BELOW **** **** **** ****

$path = $ENV{'PATH_INFO'};
$file = $ENV{'QUERY_STRING'};


if (!$path) {
	print "Content-type: text/html\n\n";
	print "<TITLE>Directory '$path' not found</TITLE>\n";
	print "<H1>Directory '$path' not found</H1>\n";
	print "Cannot find directory '$path' in the file system\n";
	exit;
}

if (!exec("$GLIMSPEHTTP_HOME/getfile $path $file")) {
	$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 $GLIMPSEHTTP_HOME/getfile : $code\n";
	exit;
}
