X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=lib%2FPublicInbox%2FDSdeflate.pm;fp=lib%2FPublicInbox%2FNNTPdeflate.pm;h=b5208e4368abd63626cf617eda1bd4ba4f00fb08;hp=352d4842834816a0df1523575aa4a6ea7f3326b3;hb=23af251dd607c4e75ab1e68063f2c885c48cc035;hpb=9b0c238f887475d920a8589b492ec15c63770152 diff --git a/lib/PublicInbox/NNTPdeflate.pm b/lib/PublicInbox/DSdeflate.pm similarity index 92% rename from lib/PublicInbox/NNTPdeflate.pm rename to lib/PublicInbox/DSdeflate.pm index 352d4842..b5208e43 100644 --- a/lib/PublicInbox/NNTPdeflate.pm +++ b/lib/PublicInbox/DSdeflate.pm @@ -2,6 +2,7 @@ # License: AGPL-3.0+ # RFC 8054 NNTP COMPRESS DEFLATE implementation +# RFC 4978 IMAP COMPRESS=DEFLATE extension # # RSS usage for 10K idle-but-did-something NNTP clients on 64-bit: # TLS + DEFLATE[a] : 1.8 GB (MemLevel=9, 1.2 GB with MemLevel=8) @@ -14,14 +15,13 @@ # [b] - memory-optimized implementation using a global deflate context. # It's less efficient in terms of compression, but way more # efficient in terms of server memory usage. -package PublicInbox::NNTPdeflate; +package PublicInbox::DSdeflate; use strict; -use 5.010_001; -use parent qw(PublicInbox::NNTP); +use v5.10.1; use Compress::Raw::Zlib; my %IN_OPT = ( - -Bufsize => PublicInbox::NNTP::LINE_MAX, + -Bufsize => 1024, -WindowBits => -15, # RFC 1951 -AppendOutput => 1, ); @@ -42,21 +42,18 @@ my $zout; $err == Z_OK or die "Failed to initialize zlib deflate stream: $err"; } - sub enable { my ($class, $self) = @_; my ($in, $err) = Compress::Raw::Zlib::Inflate->new(%IN_OPT); if ($err != Z_OK) { $self->err("Inflate->new failed: $err"); - $self->write(\"403 Unable to activate compression\r\n"); return; } - $self->write(\"206 Compression active\r\n"); bless $self, $class; $self->{zin} = $in; } -# overrides PublicInbox::NNTP::compressed +# overrides PublicInbox::DS::compressed sub compressed { 1 } sub do_read ($$$$) {