From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8D4E91FF76; Sun, 25 Dec 2016 09:40:25 +0000 (UTC) Date: Sun, 25 Dec 2016 09:40:25 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/1] http: fix clobbering of $null_io Message-ID: <20161225094025.GA14200@dcvr.yhbt.net> References: <20161126085505.15837-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161126085505.15837-1-e@80x24.org> List-Id: Oops, this would be disatrous if we started handling bigger request bodies or slow clients. Fixes: c008654229a9 ("avoid IO::File for anonymous temporary files") --- lib/PublicInbox/HTTP.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index cac14be..c4b74b4 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -328,7 +328,7 @@ sub more ($$) { sub input_prepare { my ($self, $env) = @_; - my $input = $null_io; + my $input; my $len = $env->{CONTENT_LENGTH}; if ($len) { if ($len > $MAX_REQUEST_BUFFER) { @@ -339,6 +339,8 @@ sub input_prepare { } elsif (env_chunked($env)) { $len = CHUNK_START; open($input, '+>', undef); + } else { + $input = $null_io; } # TODO: expire idle clients on ENFILE / EMFILE -- EW