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] httpd: remove unnecessary eval
@ 2016-03-05 21:02  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-03-05 21:02 UTC (permalink / raw)
  To: meta

We have per-middleware evals to deal with them being missing;
no need to put an eval around the whole thing and use an
extra level of indentation.
---
 script/public-inbox-httpd | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/script/public-inbox-httpd b/script/public-inbox-httpd
index b6c4e67..e7ed3c9 100755
--- a/script/public-inbox-httpd
+++ b/script/public-inbox-httpd
@@ -23,28 +23,26 @@ my $refresh = sub {
 		require PublicInbox::WWW;
 		PublicInbox::WWW->preload;
 		my $www = PublicInbox::WWW->new;
-		$app = eval {
-			builder {
-				enable 'Chunked';
-				eval {
-					enable 'Deflater',
-						content_type => [ qw(
-							text/html
-							text/plain
-							application/atom+xml
-							)]
-				};
-				$@ and warn
+		$app = builder {
+			enable 'Chunked';
+			eval {
+				enable 'Deflater',
+					content_type => [ qw(
+						text/html
+						text/plain
+						application/atom+xml
+						)]
+			};
+			$@ and warn
 "Plack::Middleware::Deflater missing, bandwidth will be wasted\n";
 
-				eval { enable 'ReverseProxy' };
-				$@ and warn
+			eval { enable 'ReverseProxy' };
+			$@ and warn
 "Plack::Middleware::ReverseProxy missing,\n",
 "URL generation for redirects may be wrong if behind a reverse proxy\n";
 
-				enable 'Head';
-				sub { $www->call(@_) };
-			};
+			enable 'Head';
+			sub { $www->call(@_) };
 		};
 	}
 };
-- 
EW


^ permalink raw reply	[relevance 7%]

Results 1-1 of 1 | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
2016-03-05 21:02  7% [PATCH] httpd: remove unnecessary eval Eric Wong

Code repositories for project(s) associated with this 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).