about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-02-29 01:34:33 +0000
committerEric Wong <e@80x24.org>2016-02-29 01:34:33 +0000
commitf93cd087e460b1196322b1e8a28612fb426f1072 (patch)
tree068b32d74dbdb040718f75a2b24fa87f32fc3f26 /lib
parent83770743503dfab6ac337bf053fb22a961c2cb54 (diff)
downloadpublic-inbox-f93cd087e460b1196322b1e8a28612fb426f1072.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/GitHTTPBackend.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 8e6d8b64..56bf24f4 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;