]> Sergey Matveev's repositories - public-inbox.git/blobdiff - examples/public-inbox.psgi
examples/public-inbox.psgi: optional deflater
[public-inbox.git] / examples / public-inbox.psgi
index 1de5bb7daec73120aa1502905dd2559b2c6cbb26..b0b9ae9850bd9620937a15dff753df152588d0df 100644 (file)
@@ -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(@_);