about summary refs log tree commit homepage
path: root/lib/PublicInbox/Qspawn.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-05 23:27:28 +0000
committerEric Wong <e@yhbt.net>2020-07-06 20:01:15 +0000
commitf982abbaa39e07090d3fb641fd9de25434c0d74c (patch)
treee5c5d0a4cd6312045ea79dd8706ac390624ed734 /lib/PublicInbox/Qspawn.pm
parent2bb3b3491416232a44ad8b318537c856cff727f4 (diff)
downloadpublic-inbox-f982abbaa39e07090d3fb641fd9de25434c0d74c.tar.gz
This will allow us to gzip responses generated by cgit
and any other CGI programs or long-lived streaming
responses we may spawn.
Diffstat (limited to 'lib/PublicInbox/Qspawn.pm')
-rw-r--r--lib/PublicInbox/Qspawn.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index d395a10b..88b6d390 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -25,8 +25,8 @@
 
 package PublicInbox::Qspawn;
 use strict;
-use warnings;
 use PublicInbox::Spawn qw(popen_rd);
+use PublicInbox::GzipFilter;
 
 # n.b.: we get EAGAIN with public-inbox-httpd, and EINTR on other PSGI servers
 use Errno qw(EAGAIN EINTR);
@@ -255,7 +255,9 @@ sub psgi_return_init_cb {
         my ($self) = @_;
         my $r = rd_hdr($self) or return;
         my $env = $self->{psgi_env};
-        my $filter = delete $env->{'qspawn.filter'};
+        my $filter = delete $env->{'qspawn.filter'} //
+                PublicInbox::GzipFilter::qsp_maybe($r->[1], $env);
+
         my $wcb = delete $env->{'qspawn.wcb'};
         my $async = delete $self->{async};
         if (scalar(@$r) == 3) { # error