Subject: | IIS didn't send EOF zo STDIN |
Date: | Sat, 21 May 2016 00:43:47 +0200 |
To: | bug-CGI-Simple [...] rt.cpan.org |
From: | Tobias Grönhagen <webmaster [...] topeg.de> |
Hello,
the IIS didn't send a EOF to STDIN, therefore every read(...) hangs if it try to read
beyond $ENV{CONTENT_LENGTH} bytes. Except for one place every call to internal_read will
hang if $ENV{CONTENT_LENGTH} isn't a multiple of 4096.
This is a specially a problem with the IIS. But there is no rule that dictates the
web-service have to send a EOF over STDIN when the amount of $ENV{CONTENT_LENGTH} bytes is
reached. So this can happen on any web-service.
The only case that works are URL-Coded POST messages because $ENV{CONTENT_LENGTH} bytes
are read.
This is not easily corrected because at least 3 places need a rewrite.
from something like that:
while ( $got_data < $length ) {
last READ unless _internal_read( $self, $handle, my $buffer );
$data .= $buffer;
$got_data += length $buffer;
to something like that:
while ( $got_data < $length ) {
my $len = 4096;
$len = $length - $got_data if($length - $got_data < $len );
last READ unless _internal_read( $self, $handle, my $buffer, $len );
$data .= $buffer;
$got_data += length $buffer;