Subject: | sysread used in CGI::Simple blocks on re-directed STDIO reads |
For post requests that come in through SCGI:
my $req = SCGI::Request->_new($sock,1); # blocking socket mode
for CGI module we used to do local STDIN
local *STDIN = $req->connection;
so $cgi = CGI->new() would get all the data.
For CGI::Simple, as it's using sysread it just stalls at this step:
elsif ( $method eq 'POST') {
if ( $length ) {
# we may not get all the data we want with a single read on
large
# POSTs as it may not be here yet! Credit Jason Luther for patch
# CGI.pm < 2.99 suffers from same bug
sysread( STDIN, $data, $length );
If it's switched to read, everything works.