Add a new function `get_the_source' which print the source

of the current cgi script as plain text if called with the
path `/get_the_source'. E.g.

        http://www.foo.com/cgi/foobar.cgi/get_the_source

print the source of the script foobar.cgi.
This commit is contained in:
Wolfram Schneider 1997-11-17 00:29:53 +00:00
parent 82ceb2d953
commit 8bb843408c
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=2175
2 changed files with 32 additions and 2 deletions

View file

@ -1,4 +1,4 @@
# $Id: cgi-style.pl,v 1.8 1997-06-10 12:47:11 jfieber Exp $
# $Id: cgi-style.pl,v 1.9 1997-11-17 00:29:53 wosch Exp $
#
# Perl routines to encapsulate various elements of HTML page style.
@ -55,3 +55,18 @@ sub short_html_header {
sub html_footer {
return "<hr><address>$hsty_author<br>$hsty_date</address>\n";
}
sub get_the_source {
return if $ENV{'PATH_INFO'} ne '/get_the_source';
open(R, $0) || do {
print "Oops! open $0: $!\n"; # should not reached
exit;
};
print "Content-type: text/plain\n\n";
while(<R>) { print }
close R;
exit;
}

View file

@ -1,4 +1,4 @@
# $Id: cgi-style.pl,v 1.8 1997-06-10 12:47:11 jfieber Exp $
# $Id: cgi-style.pl,v 1.9 1997-11-17 00:29:53 wosch Exp $
#
# Perl routines to encapsulate various elements of HTML page style.
@ -55,3 +55,18 @@ sub short_html_header {
sub html_footer {
return "<hr><address>$hsty_author<br>$hsty_date</address>\n";
}
sub get_the_source {
return if $ENV{'PATH_INFO'} ne '/get_the_source';
open(R, $0) || do {
print "Oops! open $0: $!\n"; # should not reached
exit;
};
print "Content-type: text/plain\n\n";
while(<R>) { print }
close R;
exit;
}