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.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE 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 46FD31F61C for ; Sat, 10 Sep 2022 08:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1662797932; bh=bYPuAwjJK1igsnnvI6xmVIPiViYgVUNDhwSORvO4oF4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=5w4xDokm5JsB934lhqVYOaLfOD2oALAXB8jK4+HavmcUjbFk/svKrJ6el/n/arfv2 RvdzL2u4HAy6iTa+ykcqzM/FZ0+oRfHizUok/fy+QD9oKUfqwWUU7qjY8O1Yk9rWKt rh54qUSeLGFgap0vTMBbplMXjsVOAcRjKaFk8dH8= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 04/38] www_atom_stream: require 200 response Date: Sat, 10 Sep 2022 08:16:55 +0000 Message-Id: <20220910081729.2011934-5-e@80x24.org> In-Reply-To: <20220910081729.2011934-1-e@80x24.org> References: <20220910081729.2011934-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This simplifies parameter passing at the moment. I can't imagine an Atom feed reader would be parsing XML for 404s or other error codes. --- lib/PublicInbox/Feed.pm | 4 ++-- lib/PublicInbox/SearchView.pm | 2 +- lib/PublicInbox/WwwAtomStream.pm | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index e0810420..bdfa0d9d 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -19,14 +19,14 @@ sub generate { my ($ctx) = @_; my $msgs = $ctx->{msgs} = recent_msgs($ctx); return _no_thread() unless @$msgs; - PublicInbox::WwwAtomStream->response($ctx, 200, \&generate_i); + PublicInbox::WwwAtomStream->response($ctx, \&generate_i); } sub generate_thread_atom { my ($ctx) = @_; my $msgs = $ctx->{msgs} = $ctx->{ibx}->over->get_thread($ctx->{mid}); return _no_thread() unless @$msgs; - PublicInbox::WwwAtomStream->response($ctx, 200, \&generate_i); + PublicInbox::WwwAtomStream->response($ctx, \&generate_i); } sub generate_html_index { diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index b025ec96..3dce768f 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -359,7 +359,7 @@ sub adump { my ($cb, $mset, $q, $ctx) = @_; $ctx->{ids} = $ctx->{ibx}->isrch->mset_to_artnums($mset); $ctx->{search_query} = $q; # used by WwwAtomStream::atom_header - PublicInbox::WwwAtomStream->response($ctx, 200, \&adump_i); + PublicInbox::WwwAtomStream->response($ctx, \&adump_i); } # callback for PublicInbox::WwwAtomStream::getline diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index 09b6facb..906b292a 100644 --- a/lib/PublicInbox/WwwAtomStream.pm +++ b/lib/PublicInbox/WwwAtomStream.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # # Atom body stream for HTTP responses @@ -43,10 +43,10 @@ sub async_eml { # for async_blob_cb } sub response { - my ($class, $ctx, $code, $cb) = @_; + my ($class, $ctx, $cb) = @_; my $res_hdr = [ 'Content-Type' => 'application/atom+xml' ]; $class->new($ctx, $cb); - $ctx->psgi_response($code, $res_hdr); + $ctx->psgi_response(200, $res_hdr); } # called once for each message by PSGI server