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 A45DE1F885 for ; Fri, 24 Jan 2020 09:43:52 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] wwwstatic: offload error handling to PSGI server Date: Fri, 24 Jan 2020 09:43:50 +0000 Message-Id: <20200124094352.19437-3-e@yhbt.net> In-Reply-To: <20200124094352.19437-1-e@yhbt.net> References: <20200124094352.19437-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The PSGI server needs to account for ->getline failing due to disk failures or truncated files, anyways. So just die() ourselves and let the PSGI server log and drop the client. --- lib/PublicInbox/WwwStatic.pm | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/PublicInbox/WwwStatic.pm b/lib/PublicInbox/WwwStatic.pm index 917049bb..e1f536f3 100644 --- a/lib/PublicInbox/WwwStatic.pm +++ b/lib/PublicInbox/WwwStatic.pm @@ -169,16 +169,7 @@ sub getline { return $buf; } my $m = defined $r ? "EOF with $len bytes left" : "read error: $!"; - my $env = $self->{env}; - $env->{'psgi.errors'}->print("$self->{path} $m\n"); - - # drop the client on error - if (my $io = $env->{'psgix.io'}) { - $io->close; # this is likely PublicInbox::DS::close - } else { # for some PSGI servers w/o psgix.io - die "dropping client socket\n"; - } - undef; + die "$self->{path} $m, dropping client socket\n"; } sub close {} # noop, called by PSGI server, just let everything go out-of-scope