From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, T_RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 54E011F6F9 for ; Fri, 11 Sep 2015 05:44:59 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] examples/public-inbox.psgi: optional deflater Date: Fri, 11 Sep 2015 05:44:59 +0000 Message-Id: <20150911054459.15591-1-e@80x24.org> List-Id: The deflater middleware isn't standard Plack, so don't require potential users install it. --- examples/public-inbox.psgi | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi index 1de5bb7..b0b9ae9 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(@_); -- EW