Skip to content

Commit

Permalink
improved IIS compatibility of Mojo::Server::CGI (closes #546)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 14, 2013
1 parent f7a103d commit 13c0507
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,6 +1,7 @@

4.47 2013-10-13
4.47 2013-10-14
- Added dumper function to Mojo::Util.
- Improved IIS compatibility of Mojo::Server::CGI.

4.46 2013-10-11
- Changed default name for generated applications from MyMojoliciousApp to
Expand Down
7 changes: 5 additions & 2 deletions lib/Mojo/Server/CGI.pm
Expand Up @@ -10,11 +10,14 @@ sub run {
my $req = $tx->req->parse(\%ENV);
$tx->local_port($ENV{SERVER_PORT})->remote_address($ENV{REMOTE_ADDR});

# Request body
# Request body (read can block if we try to read too much)
binmode STDIN;
my $len = $req->headers->content_length;
until ($req->is_finished) {
last unless my $read = STDIN->read(my $buffer, 131072, 0);
my $chunk = ($len && $len < 131072) ? $len : 131072;
last unless my $read = STDIN->read(my $buffer, $chunk, 0);
$req->parse($buffer);
last if ($len -= $read) <= 0;
}

# Handle request
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/PSGI.pm
Expand Up @@ -8,7 +8,7 @@ sub run {
my $req = $tx->req->parse($env);
$tx->local_port($env->{SERVER_PORT})->remote_address($env->{REMOTE_ADDR});

# Request body
# Request body (read can block if we try to read too much)
my $len = $env->{CONTENT_LENGTH};
until ($req->is_finished) {
my $chunk = ($len && $len < 131072) ? $len : 131072;
Expand Down

0 comments on commit 13c0507

Please sign in to comment.