diff options
author | Eric Wong <e@80x24.org> | 2022-09-10 08:16:53 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-09-10 19:50:25 +0000 |
commit | 133c9c61c0fe7e0e2d8d00e9935b3433b806ddc7 (patch) | |
tree | 3d8bccc83610cd77f64024244adeb090d4d6bd15 /lib/PublicInbox/GzipFilter.pm | |
parent | bb3e51c9fdaf1059c2ae8368a527b4bd87b0b423 (diff) | |
download | public-inbox-133c9c61c0fe7e0e2d8d00e9935b3433b806ddc7.tar.gz |
This seems like the least disruptive way to allow more use of ->zmore when streaming large messages to sockets.
Diffstat (limited to 'lib/PublicInbox/GzipFilter.pm')
-rw-r--r-- | lib/PublicInbox/GzipFilter.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm index 86d34183..75ba625e 100644 --- a/lib/PublicInbox/GzipFilter.pm +++ b/lib/PublicInbox/GzipFilter.pm @@ -140,8 +140,8 @@ sub zmore { my $self = $_[0]; # $_[1] => input http_out($self); my $err; - for (1..$#_) { - $err = $self->{gz}->deflate($_[$_], $self->{zbuf}); + for (delete $self->{obuf}, @_[1..$#_]) { + $err = $self->{gz}->deflate($_ // next, $self->{zbuf}); die "gzip->deflate: $err" if $err != Z_OK; } undef; @@ -153,8 +153,9 @@ sub zflush ($;@) { my $zbuf = delete $self->{zbuf}; my $gz = delete $self->{gz}; my $err; - for (1..$#_) { # it's a bug iff $gz is undef w/ $_[1..] - $err = $gz->deflate($_[$_], $zbuf); + # it's a bug iff $gz is undef w/ $obuf or $_[1..] + for (delete $self->{obuf}, @_[1..$#_]) { + $err = $gz->deflate($_ // next, $zbuf); die "gzip->deflate: $err" if $err != Z_OK; } $gz // return ''; # not a bug, recursing on DS->write failure |