getting plain cgi scripts working with nginx setup

This commit is contained in:
Dan Buch
2011-01-03 17:18:06 -05:00
parent 50c240b0e1
commit 080b7ba992
7 changed files with 230 additions and 9 deletions

View File

@@ -1,17 +1,35 @@
package base;
use strict;
use warnings;
use nginx;
sub handler {
my $r = shift;
$r->send_http_header("text/plain");
return OK if $r->header_only;
my $r = shift();
$r->print("hello!\n");
$r->rflush;
$r->send_http_header("text/plain");
return OK if $r->header_only();
$r->print("Hello There!\n");
$r->rflush();
if (-f $r->filename or -d _) {
$r->print($r->uri, " exists!\n");
} else {
$r->print($r->uri, " does not exist!\n");
}
my $directory = '/home/me/tmp';
# '/home/me/src/LearningPerl/src/web';
my $didopen = opendir(DIR, $directory);
if ($didopen) {
while (my $file = readdir(DIR)) {
$r->print("$file\n");
}
closedir(DIR);
}
}