From 417da3e8e52776ca539572dbc023ad02bb359dd1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Mar 2016 02:09:21 +0000 Subject: http: ensure errors are printable before PSGI env 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 8988e7d2..15db1390 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); } -- cgit v1.2.3-24-ge0c7