summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-02-07 09:59:17 +0100
committerYorhel <git@yorhel.nl>2011-02-07 09:59:17 +0100
commit1df993185b04a1e0f3515154a555bd16ac356939 (patch)
tree55163164b246dd5ee41fa7c5ceaffcef07970784
parent4d2c987b2329145d929381faba53a9b1e847ef08 (diff)
Make sure to sent an 'Allow' header on a 405 response
-rw-r--r--lib/TUWF.pm1
-rw-r--r--lib/TUWF.pod4
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/TUWF.pm b/lib/TUWF.pm
index aa0c21c..3716b92 100644
--- a/lib/TUWF.pm
+++ b/lib/TUWF.pm
@@ -126,6 +126,7 @@ sub _very_simple_page {
my($s, $code, $title, $msg) = @_;
$s->resInit;
$s->resStatus($code);
+ $s->resHeader(Allow => 'GET, HEAD, POST') if $code == 405;
my $fd = $s->resFd;
print $fd <<__;
<!DOCTYPE html
diff --git a/lib/TUWF.pod b/lib/TUWF.pod
index 7709c91..5e24a29 100644
--- a/lib/TUWF.pod
+++ b/lib/TUWF.pod
@@ -344,7 +344,9 @@ expected to generate a response.
Similar to I<error_404_handler>, but is called when the HTTP request method is
something other than HEAD, GET or POST. These requests are usually generated by
bots or applications which don't actually read the response contents, so
-overriding the default 405 error page makes little sense in most situations.
+overriding the default 405 error page makes little sense in most situations. If
+you do override it, do not forget to add an C<Allow> HTTP header to the
+response, as required by the HTTP standard.
=item error_413_handler