From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DF7F01F888 for ; Thu, 19 Oct 2023 12:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1697719221; bh=b9AaqbgAEKos/DBHDP6EEg6U32p8rvD4l4WJfxPJkYk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=goqKPiLvh8KPe6sgzZJs6U0EHZfXyHrsd7j7GZFG3AxVe9c0PkLtUkVC/5WQWrKSO G4PIuiq8MQHoelgrqVLJJ3cTKjG9DWw5HpO8b1r6/htFsI1ujtAlQLVY1uKxAcYVWP pUpNPksZfL03UYerGDyxQUSMHqUyEiDVeIdaeStA= From: Eric Wong To: spew@80x24.org Subject: [PATCH 18/18] kill getlinebody Date: Thu, 19 Oct 2023 12:40:18 +0000 Message-ID: <20231019124018.2109632-18-e@80x24.org> In-Reply-To: <20231019124018.2109632-1-e@80x24.org> References: <20231019124018.2109632-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- MANIFEST | 1 - lib/PublicInbox/GetlineBody.pm | 46 ---------------------------------- 2 files changed, 47 deletions(-) delete mode 100644 lib/PublicInbox/GetlineBody.pm diff --git a/MANIFEST b/MANIFEST index bac28d62..6cdd144e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -203,7 +203,6 @@ lib/PublicInbox/Filter/SubjectTag.pm lib/PublicInbox/Filter/Vger.pm lib/PublicInbox/Gcf2.pm lib/PublicInbox/Gcf2Client.pm -lib/PublicInbox/GetlineBody.pm lib/PublicInbox/Git.pm lib/PublicInbox/GitAsyncCat.pm lib/PublicInbox/GitCredential.pm diff --git a/lib/PublicInbox/GetlineBody.pm b/lib/PublicInbox/GetlineBody.pm deleted file mode 100644 index 0e781224..00000000 --- a/lib/PublicInbox/GetlineBody.pm +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2016-2021 all contributors -# License: AGPL-3.0+ - -# Wrap a pipe or file for PSGI streaming response bodies and calls the -# end callback when the object goes out-of-scope. -# This depends on rpipe being _blocking_ on getline. -# -# This is only used by generic PSGI servers and not public-inbox-httpd -package PublicInbox::GetlineBody; -use strict; -use warnings; - -sub new { - my ($class, $rpipe, $end, $end_arg, $buf, $filter) = @_; - bless { - rpipe => $rpipe, - end => $end, - end_arg => $end_arg, - initial_buf => $buf, - filter => $filter, - }, $class; -} - -# close should always be called after getline returns undef, -# but a client aborting a connection can ruin our day; so lets -# hope our underlying PSGI server does not leak references, here. -sub DESTROY { $_[0]->close } - -sub getline { - my ($self) = @_; - my $rpipe = $self->{rpipe} or return; # EOF was set on previous call - my $buf = delete($self->{initial_buf}) // $rpipe->getline; - delete($self->{rpipe}) unless defined $buf; # set EOF for next call - if (my $filter = $self->{filter}) { - $buf = $filter->translate($buf); - } - $buf; -} - -sub close { - my ($self) = @_; - my ($end, $end_arg) = delete @$self{qw(end end_arg)}; - $end->($end_arg) if $end; -} - -1;