diff --git a/tormon/error.tt b/tormon/error.tt
new file mode 100644
index 0000000..aaec234
--- /dev/null
+++ b/tormon/error.tt
@@ -0,0 +1,2 @@
+
Error <% err %>
+If you think this is a bug, please email albino AT autistici DOT org. Thanks!
diff --git a/tormon/tormon.fcgi b/tormon/tormon.fcgi
index f9f07b4..91ad1f7 100755
--- a/tormon/tormon.fcgi
+++ b/tormon/tormon.fcgi
@@ -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 = "";
+ $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};
}