]> Sergey Matveev's repositories - public-inbox.git/commitdiff
wwwstatic: offload error handling to PSGI server
authorEric Wong <e@yhbt.net>
Fri, 24 Jan 2020 09:43:50 +0000 (09:43 +0000)
committerEric Wong <e@yhbt.net>
Sat, 25 Jan 2020 19:20:54 +0000 (19:20 +0000)
The PSGI server needs to account for ->getline failing
due to disk failures or truncated files, anyways.  So
just die() ourselves and let the PSGI server log and
drop the client.

lib/PublicInbox/WwwStatic.pm

index 917049bb68fde1d49c50d1a4056d5ad9d47aaa35..e1f536f3f21c1d7ce63ea74f140d2646fb1284b1 100644 (file)
@@ -169,16 +169,7 @@ sub getline {
                return $buf;
        }
        my $m = defined $r ? "EOF with $len bytes left" : "read error: $!";
                return $buf;
        }
        my $m = defined $r ? "EOF with $len bytes left" : "read error: $!";
-       my $env = $self->{env};
-       $env->{'psgi.errors'}->print("$self->{path} $m\n");
-
-       # drop the client on error
-       if (my $io = $env->{'psgix.io'}) {
-               $io->close; # this is likely PublicInbox::DS::close
-       } else { # for some PSGI servers w/o psgix.io
-               die "dropping client socket\n";
-       }
-       undef;
+       die "$self->{path} $m, dropping client socket\n";
 }
 
 sub close {} # noop, called by PSGI server, just let everything go out-of-scope
 }
 
 sub close {} # noop, called by PSGI server, just let everything go out-of-scope