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
my $buf;
my $in;
my $err = $env->{'psgi.errors'};
my $buf;
my $in;
my $err = $env->{'psgi.errors'};
- if (fileno($input) >= 0) {
+ my $fd = eval { fileno($input) };
+ if (defined $fd && $fd >= 0) {
- } else { # FIXME untested
$in = input_to_file($env) or return r(500);
}
my ($rpipe, $wpipe);
$in = input_to_file($env) or return r(500);
}
my ($rpipe, $wpipe);
foreach my $l (split(/\r\n/, $h)) {
my ($k, $v) = split(/:\s*/, $l, 2);
if ($k =~ /\AStatus\z/i) {
foreach my $l (split(/\r\n/, $h)) {
my ($k, $v) = split(/:\s*/, $l, 2);
if ($k =~ /\AStatus\z/i) {
+ ($code) = ($v =~ /\b(\d+)\b/);
} else {
push @h, $k, $v;
}
} else {
push @h, $k, $v;
}
-# FIXME: untested, our -httpd _always_ gives a real file handle
sub input_to_file {
my ($env) = @_;
my $in = IO::File->new_tmpfile;
sub input_to_file {
my ($env) = @_;
my $in = IO::File->new_tmpfile;