* [PATCH 0/4] various cleanups around http
@ 2016-12-25 10:36 7% Eric Wong
2016-12-25 10:36 7% ` [PATCH 3/4] githttpbackend: minor cleanups to improve readability Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-12-25 10:36 UTC (permalink / raw)
To: meta
Eric Wong (4):
githttpbackend: minor readability improvement
githttpbackend: simplify compatibility code
githttpbackend: minor cleanups to improve readability
httpd/async: improve variable naming
examples/public-inbox.psgi | 1 +
lib/PublicInbox/GitHTTPBackend.pm | 41 +++++++++++++++++----------------------
lib/PublicInbox/HTTPD/Async.pm | 14 ++++++-------
3 files changed, 26 insertions(+), 30 deletions(-)
^ permalink raw reply [relevance 7%]
* [PATCH 3/4] githttpbackend: minor cleanups to improve readability
2016-12-25 10:36 7% [PATCH 0/4] various cleanups around http Eric Wong
@ 2016-12-25 10:36 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-12-25 10:36 UTC (permalink / raw)
To: meta
Fewer returns improves readability and the diffstat agrees.
---
lib/PublicInbox/GitHTTPBackend.pm | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 4ad3fd1..1fa5e30 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -225,7 +225,6 @@ sub serve_smart {
};
my $res;
my $async = $env->{'pi-httpd.async'}; # XXX unstable API
- my $io = $env->{'psgix.io'};
my $cb = sub {
my $r = $rd_hdr->() or return;
$rd_hdr = undef;
@@ -236,17 +235,16 @@ sub serve_smart {
$rpipe->close;
$end->();
}
- return $res->($r);
- }
- if ($async) {
+ $res->($r);
+ } elsif ($async) {
$fh = $res->($r);
- return $async->async_pass($io, $fh, \$buf);
+ $async->async_pass($env->{'psgix.io'}, $fh, \$buf);
+ } else { # for synchronous PSGI servers
+ require PublicInbox::GetlineBody;
+ $r->[2] = PublicInbox::GetlineBody->new($rpipe, $end,
+ $buf);
+ $res->($r);
}
-
- # for synchronous PSGI servers
- require PublicInbox::GetlineBody;
- $r->[2] = PublicInbox::GetlineBody->new($rpipe, $end, $buf);
- $res->($r);
};
sub {
($res) = @_;
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-12-25 10:36 7% [PATCH 0/4] various cleanups around http Eric Wong
2016-12-25 10:36 7% ` [PATCH 3/4] githttpbackend: minor cleanups to improve readability 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).