/[hydra]/hydra/examples/nph-test.cgi
ViewVC logotype

Contents of /hydra/examples/nph-test.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Sat Sep 21 13:54:15 2002 UTC (19 years, 1 month ago) by nmav
Branch: boas, MAIN
CVS Tags: hydra_0_1_6_without_hic, BOAS_WITH_RANGES_AND_CGI, hydra_0_0_10, start, hydra_0_0_8, hydra_0_0_9, hydra_0_0_2, hydra_0_0_3, hydra_0_0_6, hydra_0_0_7, hydra_0_0_4, hydra_0_0_5, hydra_0_1_3, hydra_0_1_2, hydra_0_1_1, hydra_0_1_0, hydra_0_1_7, hydra_0_1_6, hydra_0_1_4, hydra_0_1_8, HEAD
Branch point for: hydra_0_1_0_patches
Changes since 1.1: +0 -0 lines
Imported sources

1 #!/usr/bin/perl
2
3 # Remember that CGI programs have to close out the HTTP header
4 # (with a pair of newlines), after giving the Content-type:
5 # and any other relevant or available header information.
6
7 # This test program always reports success (200 OK), and
8 # correctly uses SERVER_PROTOCOL and REQUEST_METHOD to decide
9 # whether or not to send the headers and content.
10
11 # Feb 3, 2000 -- updated to support POST, and avoid passing
12 # Malicious HTML Tags as described in CERT's CA-2000-02 advisory.
13
14 $now=`date`;
15 chomp($now);
16 if ($ENV{"SERVER_PROTOCOL"} ne "HTTP/0.9") {
17 print "HTTP/1.0 200 OK\r\nDate: $now\r\n";
18 print "Connection: close\r\n";
19 print "Content-type: text/html; charset=ISO-8859-1\r\n\r\n";
20 }
21
22 exit 0 if ($ENV{"REQUEST_METHOD"} eq "HEAD");
23
24 print "<html><head><title>Boa nph-CGI test</title></head><body>\n";
25 print "<H2>Boa nph-CGI test</H2>\n\n";
26
27 print "Date: $now\n";
28
29 print "<P>\n\n<UL>\n";
30
31 foreach (keys %ENV) {
32 $a= $ENV{$_};
33 $a=~s/&/&amp;/g;
34 $a=~s/</&lt;/g;
35 $a=~s/>/&gt;/g;
36 print "<LI>$_ == $a\n";
37 }
38
39 print "</UL>\n";
40
41 if ($ENV{REQUEST_METHOD} eq "POST") {
42 print "Input stream:<br><hr><pre>\n";
43 while (<stdin>) {
44 s/&/&amp;/g;
45 s/</&lt;/g;
46 s/>/&gt;/g;
47 print "$_";
48 }
49 print "</pre><hr>\n";
50 }
51
52 print "id: ", `id`, "\n<p>\n";
53
54 if ($ENV{"QUERY_STRING"}=~/ident/ && $ENV{"REMOTE_PORT"} ne "") {
55
56 # Uses idlookup-1.2 from Peter Eriksson <pen@lysator.liu.se>
57 # ftp://coast.cs.purdue.edu/pub/tools/unix/ident/tools/idlookup-1.2.tar.gz
58 # Could use modification to timeout and trap stderr messages
59 $a="idlookup ".
60 $ENV{"REMOTE_ADDR"}." ".$ENV{"REMOTE_PORT"}." ".$ENV{"SERVER_PORT"};
61 $b=qx/$a/;
62 print "ident output:<br><pre>\n$b</pre>\n";
63 }
64
65 print "\n<EM>Boa http server</EM>\n";
66 print "</body></html>\n";
67
68 exit 0;
69

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26