diff options
author | Eric Wong <e@yhbt.net> | 2020-06-16 22:31:21 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-21 00:42:34 +0000 |
commit | 3c947561fa0678803158f2174ff87992addb3c7e (patch) | |
tree | 2e96f4a6c095de922055df10403a4ce7c424f799 /lib/PublicInbox/NNTPdeflate.pm | |
parent | 8fd41797b24736dfdccfacc5acc473234a29758a (diff) | |
download | public-inbox-3c947561fa0678803158f2174ff87992addb3c7e.tar.gz |
This matches PublicInbox::IMAP::event_step and will allow us to handle blob retrievals from git asynchronously without falling over on pipelined requests.
Diffstat (limited to 'lib/PublicInbox/NNTPdeflate.pm')
-rw-r--r-- | lib/PublicInbox/NNTPdeflate.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/PublicInbox/NNTPdeflate.pm b/lib/PublicInbox/NNTPdeflate.pm index eb400c9c..dec88aba 100644 --- a/lib/PublicInbox/NNTPdeflate.pm +++ b/lib/PublicInbox/NNTPdeflate.pm @@ -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); |