From: Eric Wong Date: Sun, 6 Mar 2016 02:09:21 +0000 (+0000) Subject: http: ensure errors are printable before PSGI env X-Git-Tag: v1.0.0~639 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=417da3e8e52776ca539572dbc023ad02bb359dd1;p=public-inbox.git 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. --- 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); }