From: Eric Wong Date: Sat, 10 Sep 2022 08:16:56 +0000 (+0000) Subject: www_stream: aresponse assumes 200, too X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=d6d1f632bf8c7f34ae014a9cd69fde699bbe183a www_stream: aresponse assumes 200, too There's no reason to be streaming large amounts of HTML for anything other than a 200 response. --- diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index bdfa0d9d..56ca9886 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -71,7 +71,7 @@ sub new_html { $ctx->{-html_tip} = '
';
 	$ctx->{-upfx} = '';
 	$ctx->{-hr} = 1;
-	PublicInbox::WwwStream::aresponse($ctx, 200, \&new_html_i);
+	PublicInbox::WwwStream::aresponse($ctx, \&new_html_i);
 }
 
 # private subs
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index 3dce768f..e0404e5f 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -325,7 +325,7 @@ sub mset_thread {
 
 	@$msgs = reverse @$msgs if $r;
 	$ctx->{msgs} = $msgs;
-	PublicInbox::WwwStream::aresponse($ctx, 200, \&mset_thread_i);
+	PublicInbox::WwwStream::aresponse($ctx, \&mset_thread_i);
 }
 
 # callback for PublicInbox::WwwStream::getline
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 033af283..1cbc62be 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -80,7 +80,7 @@ sub msg_page {
 	# allow user to easily browse the range around this message if
 	# they have ->over
 	$ctx->{-t_max} = $smsg->{ts};
-	PublicInbox::WwwStream::aresponse($ctx, 200, \&msg_page_i);
+	PublicInbox::WwwStream::aresponse($ctx, \&msg_page_i);
 }
 
 # /$INBOX/$MESSAGE_ID/#R
@@ -432,7 +432,7 @@ sub stream_thread_i { # PublicInbox::WwwStream::getline callback
 sub stream_thread ($$) {
 	my ($rootset, $ctx) = @_;
 	@{$ctx->{-queue}} = map { (0, $_) } @$rootset;
-	PublicInbox::WwwStream::aresponse($ctx, 200, \&stream_thread_i);
+	PublicInbox::WwwStream::aresponse($ctx, \&stream_thread_i);
 }
 
 # /$INBOX/$MSGID/t/ and /$INBOX/$MSGID/T/
@@ -483,7 +483,7 @@ EOF
 	# flat display: lazy load the full message from smsg
 	$ctx->{msgs} = $msgs;
 	$ctx->{-html_tip} = '
';
-	PublicInbox::WwwStream::aresponse($ctx, 200, \&thread_html_i);
+	PublicInbox::WwwStream::aresponse($ctx, \&thread_html_i);
 }
 
 sub thread_html_i { # PublicInbox::WwwStream::getline callback
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 115e0440..1fc213d4 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -205,9 +205,9 @@ sub async_next ($) {
 }
 
 sub aresponse {
-	my ($ctx, $code, $cb) = @_;
+	my ($ctx, $cb) = @_;
 	init($ctx, $cb);
-	$ctx->psgi_response($code, delete $ctx->{-res_hdr});
+	$ctx->psgi_response(200, delete $ctx->{-res_hdr});
 }
 
 sub html_init {