about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-07-23 04:41:55 +0000
committerEric Wong <e@80x24.org>2022-07-23 14:22:34 +0000
commit23af251dd607c4e75ab1e68063f2c885c48cc035 (patch)
treea34def1fda7d3e5741dd05301032dd62908579be /lib/PublicInbox/NNTP.pm
parent9b0c238f887475d920a8589b492ec15c63770152 (diff)
downloadpublic-inbox-23af251dd607c4e75ab1e68063f2c885c48cc035.tar.gz
Their code was nearly identical to begin with, so save some
memory in -netd and disk space for all of our tarball/distro
users, at least.

And I seem to have used multiple inheritance successfully, here,
maybe...
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 3929f817..8ad7adc1 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -883,8 +883,6 @@ sub cmd_xover ($;$) {
         $self->long_response(\&xover_i, @$r);
 }
 
-sub compressed { undef }
-
 sub cmd_starttls ($) {
         my ($self) = @_;
         my $sock = $self->{sock} or return;
@@ -903,7 +901,9 @@ sub cmd_compress ($$) {
         my ($self, $alg) = @_;
         return "503 Only DEFLATE is supported\r\n" if uc($alg) ne 'DEFLATE';
         return r502 if $self->compressed;
-        PublicInbox::NNTPdeflate->enable($self);
+        PublicInbox::NNTPdeflate->enable($self) or return
+                                \"403 Unable to activate compression\r\n";
+        PublicInbox::DS::write($self, \"206 Compression active\r\n");
         $self->requeue;
         undef
 }
@@ -985,4 +985,8 @@ sub busy { # for graceful shutdown in PublicInbox::Daemon:
         defined($self->{rbuf}) || defined($self->{wbuf})
 }
 
+package PublicInbox::NNTPdeflate;
+use PublicInbox::DSdeflate;
+our @ISA = qw(PublicInbox::DSdeflate PublicInbox::NNTP);
+
 1;