* [PATCH 8/8] git-http-backend: fixes for mod_perl
2016-02-29 1:40 6% [PATCH 0/8] another round of HTTP-related fixes Eric Wong
@ 2016-02-29 1:41 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-02-29 1:41 UTC (permalink / raw)
To: meta
Apache2 mod_perl does not give us a real file handle, so
we must translate that before giving that to git-http-backend(1).
Also, parse the Status: correctly for errors since we failed to
set %ENV properly before the previous fix for SpawnPP
---
lib/PublicInbox/GitHTTPBackend.pm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 8e6d8b6..56bf24f 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -132,9 +132,10 @@ sub serve_smart {
my $buf;
my $in;
my $err = $env->{'psgi.errors'};
- if (fileno($input) >= 0) {
+ my $fd = eval { fileno($input) };
+ if (defined $fd && $fd >= 0) {
$in = $input;
- } else { # FIXME untested
+ } else {
$in = input_to_file($env) or return r(500);
}
my ($rpipe, $wpipe);
@@ -208,7 +209,7 @@ sub serve_smart {
foreach my $l (split(/\r\n/, $h)) {
my ($k, $v) = split(/:\s*/, $l, 2);
if ($k =~ /\AStatus\z/i) {
- $code = int($v);
+ ($code) = ($v =~ /\b(\d+)\b/);
} else {
push @h, $k, $v;
}
@@ -233,7 +234,6 @@ sub serve_smart {
}
}
-# FIXME: untested, our -httpd _always_ gives a real file handle
sub input_to_file {
my ($env) = @_;
my $in = IO::File->new_tmpfile;
--
EW
^ permalink raw reply related [relevance 7%]
* [PATCH 0/8] another round of HTTP-related fixes
@ 2016-02-29 1:40 6% Eric Wong
2016-02-29 1:41 7% ` [PATCH 8/8] git-http-backend: fixes for mod_perl Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-02-29 1:40 UTC (permalink / raw)
To: meta
git clone for Smart HTTP now works properly when using Apache2 \o/
Eric Wong (8):
http: error check for sysseek on input
http: document event_write usage
http: avoid needless time2str calls
distinguish error messages intended for users vs developers
favor procedural calls for most private functions
git-http-backend: stricter parsing of CRLF
spawnpp: use env(1) for mod_perl compatibility
git-http-backend: fixes for mod_perl
lib/PublicInbox/Config.pm | 6 +++---
lib/PublicInbox/Daemon.pm | 18 ++++++++----------
lib/PublicInbox/GitHTTPBackend.pm | 12 ++++++------
lib/PublicInbox/HTTP.pm | 40 ++++++++++++++++++++++-----------------
lib/PublicInbox/NNTP.pm | 30 ++++++++++++++---------------
lib/PublicInbox/Spawn.pm | 3 ++-
lib/PublicInbox/SpawnPP.pm | 9 ++-------
lib/PublicInbox/WWW.pm | 2 +-
script/public-inbox-httpd | 2 +-
9 files changed, 61 insertions(+), 61 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-02-29 1:40 6% [PATCH 0/8] another round of HTTP-related fixes Eric Wong
2016-02-29 1:41 7% ` [PATCH 8/8] git-http-backend: fixes for mod_perl 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).