handle erros
This commit is contained in:
parent
d54340e067
commit
f17e930ab4
|
@ -0,0 +1,2 @@
|
|||
<h1>Error <% err %></h1>
|
||||
If you think this is a bug, please email albino AT autistici DOT org. Thanks!
|
|
@ -30,18 +30,25 @@ my $request = FCGI::Request(
|
|||
);
|
||||
|
||||
while ($request->Accept() <= 0) {
|
||||
print "Content-Type: text/html\n\n";
|
||||
my $content;
|
||||
my $code;
|
||||
|
||||
switch ($ENV{"REQUEST_URI"}) {
|
||||
case "/debug" {
|
||||
# TODO - remove this, it's a security vulnerability
|
||||
use Data::Dumper;
|
||||
$content = "<textarea>" . Dumper(\%ENV) . "</textarea>";
|
||||
$code = "\n"; # 200 OK
|
||||
}
|
||||
case "/" {
|
||||
my $tt = read_file("$Bin/index.tt");
|
||||
$content = ${ $tmpl->render($tt, {version => $VERSION}) };
|
||||
$code = "\n"; # 200 OK
|
||||
}
|
||||
else {
|
||||
my $tt = read_file("$Bin/error.tt");
|
||||
$content = ${ $tmpl->render($tt, {err => 404}) };
|
||||
$code = "Status: 404 Not Found\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,5 +59,5 @@ while ($request->Accept() <= 0) {
|
|||
content => $content,
|
||||
},
|
||||
);
|
||||
print ${$html};
|
||||
print "Content-Type: text/html\n", $code, ${$html};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue