]> Sergey Matveev's repositories - public-inbox.git/commitdiff
githttpbackend: avoid infinite loop on generic PSGI servers
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Tue, 27 Mar 2018 21:27:00 +0000 (21:27 +0000)
committerEric Wong <e@80x24.org>
Tue, 27 Mar 2018 21:27:39 +0000 (21:27 +0000)
We must detect EOF when reading a POST body with standard PSGI servers.
This does not affect deployments using the standard public-inbox-httpd;
but most smaller inboxes should be able to get away using a generic
PSGI server.

lib/PublicInbox/GitHTTPBackend.pm

index 4d2816a00c4b92b8a9b562906b9d944f567eadaa..6efe5b31d485086b0f4c4825a98b52c5180d9e60 100644 (file)
@@ -280,6 +280,7 @@ sub input_to_file {
                        err($env, "error reading input: $!");
                        return;
                }
+               last if $r == 0;
                my $off = 0;
                while ($r > 0) {
                        my $w = syswrite($in, $buf, $r, $off);