user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] www: missing /$INBOX/$MSGID/raw returns 404
@ 2021-04-26  8:02 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-04-26  8:02 UTC (permalink / raw)
  To: meta

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-26  8:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26  8:02 [PATCH] www: missing /$INBOX/$MSGID/raw returns 404 Eric Wong

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.mail.public-inbox.meta
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.mail.public-inbox.meta
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git