unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] www: missing /$INBOX/$MSGID/raw returns 404
Date: Mon, 26 Apr 2021 08:02:16 +0000	[thread overview]
Message-ID: <20210426080216.3802-1-e@80x24.org> (raw)

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

                 reply	other threads:[~2021-04-26  8:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210426080216.3802-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).