]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/NNTPdeflate.pm
nntp: event_step: prepare for async git reads
[public-inbox.git] / lib / PublicInbox / NNTPdeflate.pm
index eb400c9c22057da11b5bd3d3d396ab79213c7108..dec88aba3a5f22d90af5c3fd8afb6a9504362f4c 100644 (file)
@@ -71,6 +71,16 @@ sub do_read ($$$$) {
        $doff = length($dbuf);
        my $r = PublicInbox::DS::do_read($self, \$dbuf, $len, $doff) or return;
 
+       # Workaround inflate bug appending to OOK scalars:
+       # <https://rt.cpan.org/Ticket/Display.html?id=132734>
+       # We only have $off if the client is pipelining, and pipelining
+       # is where our substr() OOK optimization in event_step makes sense.
+       if ($off) {
+               my $copy = $$rbuf;
+               undef $$rbuf;
+               $$rbuf = $copy;
+       }
+
        # assert(length($$rbuf) == $off) as far as NNTP.pm is concerned
        # -ConsumeInput is true, so $dbuf is automatically emptied
        my $err = $zin->inflate($dbuf, $rbuf);