From 9511829a9c836a2887d9a569275cc599a463d922 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 25 Dec 2016 09:40:25 +0000 Subject: http: fix clobbering of $null_io 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(-) (limited to 'lib/PublicInbox/HTTP.pm') diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index cac14be3..c4b74b45 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 -- cgit v1.2.3-24-ge0c7