From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 3D7591F5AE for ; Mon, 26 Apr 2021 08:02:16 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] www: missing /$INBOX/$MSGID/raw returns 404 Date: Mon, 26 Apr 2021 08:02:16 +0000 Message-Id: <20210426080216.3802-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Don't attempt to return HTTP 300 via Extmsg on it, since whoever uses /raw is likely piping it to some other command. --- lib/PublicInbox/WWW.pm | 2 +- t/plack.t | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 456692a3..8f4bfd0f 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -272,7 +272,7 @@ sub get_index { sub get_mid_txt { my ($ctx) = @_; require PublicInbox::Mbox; - PublicInbox::Mbox::emit_raw($ctx) || r404($ctx); + PublicInbox::Mbox::emit_raw($ctx) || r(404); } # /$INBOX/$MESSAGE_ID/ -> HTML content (short quotes) diff --git a/t/plack.t b/t/plack.t index db72e6cc..40ff2baa 100644 --- a/t/plack.t +++ b/t/plack.t @@ -82,6 +82,8 @@ test_psgi($app, sub { $res = $cb->(GET('http://example.com/test/crlf@example.com/raw')); is($res->code, 200, 'retrieved CRLF raw'); like($res->content, qr/\r/, 'CR preserved in raw message'); + $res = $cb->(GET('http://example.com/test/bogus@example.com/raw')); + is($res->code, 404, 'missing /raw is 404'); }); # redirect with newsgroup