Permalink
Browse files

Item14221: Trying to get the postdata and $request->param() working a…

…gain.

CGI.pm does not support any other handles for normal operation but
STDIN. FCGI::Request doesn't support any other mode but tie'ing of
standard file handles. This combination make any other way of handling
client input but via STDIN simply impossible.
  • Loading branch information...
vrurg committed Nov 21, 2016
1 parent 2792adc commit f6350568d34334fc1ae432ca2ac8aa0f45ffd4f6
@@ -65,13 +65,17 @@ 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->{$_} = IO::Handle->new foreach qw(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,
+
+ STDERR->fdopen( $this->{fhERR}->fileno, "w" );
+
+ my $r =
+ FCGI::Request( \*STDIN, $this->{fhOUT}, $this->{fhERR}, \%ENV, $sock,
&FCGI::FAIL_ACCEPT_ON_INTR );
my $manager;
@@ -34,7 +34,7 @@ BEGIN {
Constructs an engine object.
-The default object has three initialized keys on it: =fhIN=, =fhOUT=, =fhERR=.
+The default object has three initialized keys on it: =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
@@ -58,7 +58,6 @@ sub new {
# Standard file handles to support engines/environments where
# communication is based on custom sockets.
- fhIN => \*STDIN,
fhOUT => \*STDOUT,
fhERR => \*STDERR,
};
@@ -234,7 +234,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 f635056

Please sign in to comment.