]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/HTTPD/Async.pm
httpd: avoid crash on cgit -> coderepo 404 fallback
[public-inbox.git] / lib / PublicInbox / HTTPD / Async.pm
index cb76cfab4a83317284ed25456ec9dd346ea80db1..9e592f47412bf4f7aa1c32555196ee92b13a06de 100644 (file)
@@ -48,7 +48,8 @@ sub event_step {
                # this may call async_pass when headers are done
                $cb->(my $refcnt_guard = delete $self->{arg});
        } elsif (my $sock = $self->{sock}) {
-               my $http = $self->{http};
+               # $http may be undef if discarding body output from cgit on 404
+               my $http = $self->{http} or return $self->close;
                # $self->{sock} is a read pipe for git-http-backend or cgit
                # and 65536 is the default Linux pipe size
                my $r = sysread($sock, my $buf, 65536);