X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FIMAPdeflate.pm;h=b98a069d9b6d00feb8e7f1aeb520c6d36e34ea45;hb=0d38f65c490466837ae091afa7a7b6f59d04ce7c;hp=67c9a9738d54836fe12edf7a5911983945c41ba4;hpb=afa44e1ddf1b9402caba5c7dc3c8e0f86194df86;p=public-inbox.git diff --git a/lib/PublicInbox/IMAPdeflate.pm b/lib/PublicInbox/IMAPdeflate.pm index 67c9a973..b98a069d 100644 --- a/lib/PublicInbox/IMAPdeflate.pm +++ b/lib/PublicInbox/IMAPdeflate.pm @@ -9,7 +9,6 @@ use warnings; use 5.010_001; use base qw(PublicInbox::IMAP); use Compress::Raw::Zlib; -use Hash::Util qw(unlock_hash); # dependency of fields for perl 5.10+, anyways my %IN_OPT = ( -Bufsize => 1024, @@ -41,7 +40,6 @@ sub enable { $self->write(\"$tag BAD failed to activate compression\r\n"); return; } - unlock_hash(%$self); $self->write(\"$tag OK DEFLATE active\r\n"); bless $self, $class; $self->{zin} = $in; @@ -59,6 +57,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: + # + # 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);