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 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 76F151F54E for ; Thu, 4 Aug 2022 20:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1659643701; bh=UROBUpSMRmjJqLCp+rRz8JeZ+JkglL+BmhTSikeZ3kg=; h=From:To:Subject:Date:From; b=qxVWxxSq7SUg9Uzy7NbMgr8R7HoydEWSDlrFlPdxnPlW3SGmfoXqV8+h/tvXIVvxK HHHFLq/FhP07qk4yrj82hGx61PwF39zUMzfo2jzpqxQOckrrnP0Rnm/QrqKv32bKkp LN+bJUU2mEcg6QqqRvlVq7CWvCxzxuQQ46OZ4Aqo= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] www: gzip_filter: avoid errors after ->write failure Date: Thu, 4 Aug 2022 20:08:21 +0000 Message-Id: <20220804200821.32059-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: ->zflush must return a string to its caller, not undef. Additionally, {http_out} may be deleted on ->write if ->close recurses. This should fix the following errors: Use of uninitialized value $_[1] in string eq at PublicInbox/HTTP.pm line 211. E: Can't call method "close" on an undefined value at GzipFilter.pm line 167. Fixes: a6d50dc1098c01a1 (www: gzip_filter: gracefully handle socket ->write failures, 2022-08-03) --- lib/PublicInbox/GzipFilter.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm index d41748c4..bdd313f5 100644 --- a/lib/PublicInbox/GzipFilter.pm +++ b/lib/PublicInbox/GzipFilter.pm @@ -154,7 +154,7 @@ sub zflush ($;$) { $err = $gz->deflate($_[1], $zbuf); die "gzip->deflate: $err" if $err != Z_OK; } - $gz // return; # not a bug, recursing on DS->write failure + $gz // return ''; # not a bug, recursing on DS->write failure $err = $gz->flush($zbuf); die "gzip->flush: $err" if $err != Z_OK; $zbuf; @@ -164,7 +164,7 @@ sub close { my ($self) = @_; my $http_out = http_out($self) // return; $http_out->write(zflush($self)); - delete($self->{http_out})->close; + (delete($self->{http_out}) // return)->close; } sub bail {