user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] examples/public-inbox.psgi: optional deflater
@ 2015-09-11  5:44  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2015-09-11  5:44 UTC (permalink / raw)
  To: meta

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


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-09-11  5:44  7% [PATCH] examples/public-inbox.psgi: optional deflater Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).