diff options
author | Eric Wong <e@80x24.org> | 2020-01-01 10:38:56 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-01-01 19:10:55 +0000 |
commit | 02f9b34f398bef722159cd54a629441f861d37b7 (patch) | |
tree | 8d58442693e693921785bd004cd1b3cb8e30266d /lib/PublicInbox/WWW.pm | |
parent | 6348b9adcf8a7d4a455298f45f62338e148d691a (diff) | |
download | public-inbox-02f9b34f398bef722159cd54a629441f861d37b7.tar.gz |
Remove redundant "r" functions for generating short error responses. These responses will no longer be cached by clients, which is probably a good thing since most errors ought to be transient, anyways. This also fixes error responses for our cgit wrapper when static files are missing.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r-- | lib/PublicInbox/WWW.pm | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 13b66ee6..99f9f1dc 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -22,6 +22,7 @@ use PublicInbox::MID qw(mid_escape); require PublicInbox::Git; use PublicInbox::GitHTTPBackend; use PublicInbox::UserContent; +use PublicInbox::WwwStatic qw(r); # TODO: consider a routing tree now that we have more endpoints: our $INBOX_RE = qr!\A/([\w\-][\w\.\-]*)!; @@ -83,7 +84,7 @@ sub call { } } elsif ($method !~ /\AGET|HEAD\z/) { - return r(405, 'Method Not Allowed'); + return r(405); } # top-level indices and feeds @@ -176,12 +177,9 @@ sub r404 { require PublicInbox::ExtMsg; return PublicInbox::ExtMsg::ext_msg($ctx); } - r(404, 'Not Found'); + r(404); } -# simple response for errors -sub r { [ $_[0], ['Content-Type' => 'text/plain'], [ join(' ', @_, "\n") ] ] } - sub news_cgit_fallback ($) { my ($ctx) = @_; my $www = $ctx->{www}; |