about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-11 05:42:40 +0000
committerEric Wong <e@80x24.org>2015-09-11 05:42:40 +0000
commite2ed3be62fbb53e16a9248a408a7a069a05842e6 (patch)
tree131e424b2e225a4aac6af71814ce51d331b34734
parentaad65bb344ebca758940e1129b5604aba1e20eee (diff)
downloadpublic-inbox-e2ed3be62fbb53e16a9248a408a7a069a05842e6.tar.gz
The deflater middleware isn't standard Plack, so don't require
potential users install it.
-rw-r--r--examples/public-inbox.psgi10
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi
index 1de5bb7d..b0b9ae98 100644
--- a/examples/public-inbox.psgi
+++ b/examples/public-inbox.psgi
@@ -9,10 +9,14 @@ use PublicInbox::WWW;
 PublicInbox::WWW->preload;
 use Plack::Request;
 use Plack::Builder;
+my $have_deflater = eval { require Plack::Middleware::Deflater; 1 };
+
 builder {
-        enable "Deflater",
-                content_type => [ 'text/html', 'text/plain',
-                                'application/atom+xml' ];
+        if ($have_deflater) {
+                enable "Deflater",
+                        content_type => [ 'text/html', 'text/plain',
+                                        'application/atom+xml' ];
+        }
         enable "Head";
         sub {
                 my $req = Plack::Request->new(@_);