From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5BC6F633824; Sun, 6 Mar 2016 02:09:29 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Cc: Eric Wong Subject: [PATCH 2/3] http: ensure errors are printable before PSGI env Date: Sun, 6 Mar 2016 02:09:21 +0000 Message-Id: <1457230162-10960-3-git-send-email-e@80x24.org> In-Reply-To: <1457230162-10960-1-git-send-email-e@80x24.org> References: <1457230162-10960-1-git-send-email-e@80x24.org> List-Id: We cannot rely on a client socket having a PSGI env before headers are fully-parsed as we seek to avoid storing hashes for idle clients. Sso print errors to the psgi.errors value which belongs to the httpd listener, instead. --- lib/PublicInbox/HTTP.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 8988e7d..15db139 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -251,7 +251,7 @@ sub env_chunked { ($_[0]->{HTTP_TRANSFER_ENCODING} || '') =~ /\bchunked\b/i } sub write_err { my ($self) = @_; - my $err = $self->{env}->{'psgi.errors'}; + my $err = $self->{httpd}->{env}->{'psgi.errors'}; my $msg = $! || '(zero write)'; $err->print("error buffering to input: $msg\n"); quit($self, 500); @@ -264,7 +264,7 @@ sub recv_err { $self->{input_left} = $len; return; } - my $err = $self->{env}->{'psgi.errors'}; + my $err = $self->{httpd}->{env}->{'psgi.errors'}; $err->print("error reading for input: $! ($len bytes remaining)\n"); quit($self, 500); } -- EW