Permalink
Browse files

Item14221: Revert Engine changes made by Item14205

Reverts two commits:
 - 74d590a
 - d079f79
  • Loading branch information...
gac410 committed Dec 5, 2016
1 parent efab1aa commit 979a363371815af6f0dcb0b0921be64ca3e6ac72
@@ -65,13 +65,7 @@ sub run {
or die "Failed to create FastCGI socket: $!";
}
$args ||= {};
-
- # Prepare output handles for FastCGI.
- $this->{$_} = IO::Handle->new foreach qw(fhIN fhOUT fhERR);
- # This is a little trick to make all `print STDERR' clauses send their
- # output to the log file. May not work for spawned processes.
- STDERR->fdopen($this->{fhERR}->fileno, "w");
- my $r = FCGI::Request( $this->{fhIN}, $this->{fhOUT}, $this->{fhERR}, \%ENV, $sock,
+ my $r = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, $sock,
&FCGI::FAIL_ACCEPT_ON_INTR );
my $manager;
@@ -193,8 +187,7 @@ sub preparePath {
}
sub write {
- my $this = shift;
- syswrite $this->{fhOUT}, $_[0];
+ syswrite STDOUT, $_[1];
}
sub closeSocket {
@@ -184,9 +184,7 @@ NOCERT
if ( $Foswiki::cfg{SMTP}{MAILHOST} ) {
- if ( 1
- || $Foswiki::cfg{Engine} && $Foswiki::cfg{Engine} !~ m/FastCGI$/ )
- {
+ if ( $Foswiki::cfg{Engine} && $Foswiki::cfg{Engine} !~ m/FastCGI$/ ) {
( $ok, $out, $err ) = _muteExec( \&_autoconfigSMTP, $reporter );
}
else {
View
@@ -34,34 +34,12 @@ BEGIN {
Constructs an engine object.
-The default object has three initialized keys on it: =fhIN=, =fhOUT=, =fhERR=.
-Those are filehandles used to communicate with HTTP server/environment and by
-default they're set to =STDIN=, =STDOUT=, and =STDERR= correspondingly. It is
-recommended to use =$engine->{fhERR}= instead of STDERR in order to get error
-messages always logged correctly:
-
-<verbatim>
-print $Foswiki::engine->{fhERR} "This is the error we wanna see in the log.\n";
-
-$SIG{__DIE__} = sub {
- print $Foswiki::engine->{fhERR} @_;
- exit 1;
-};
-</verbatim>
-
=cut
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
- my $this = {
-
- # Standard file handles to support engines/environments where
- # communication is based on custom sockets.
- fhIN => \*STDIN,
- fhOUT => \*STDOUT,
- fhERR => \*STDERR,
- };
+ my $this = {};
return bless $this, $class;
}
@@ -220,7 +220,7 @@ sub prepareBody {
# as breaking uploads (though cdot believes this is because of the
# deprecated dual nature of param delivering lightweight file handles,
# and it would probably work in Foswiki. Just not tried it)
- my $cgi = new CGI( $this->{fhIN} );
+ my $cgi = new CGI();
my $err = $cgi->cgi_error;
throw Foswiki::EngineException( $1, $2 )
if defined $err && $err =~ m/\s*(\d{3})\s*(.*)/;

0 comments on commit 979a363

Please sign in to comment.