Permalink
Browse files

Work around for new Rakudo IO::read() behavior.

  • Loading branch information...
1 parent 6e6aceb commit 6be09a9e1666f910e900906ecd85bd062054d148 Timothy Totten committed Jan 5, 2013
Showing with 13 additions and 3 deletions.
  1. +13 −3 lib/SCGI/Request.pm6
View
@@ -10,9 +10,19 @@ has $.request;
method parse ()
{
- $!request = $.connection.socket.recv();
- my $rlen = $.request.chars;
my $debug = $.connection.parent.debug;
+ my $received = False;
+ ## The while loop with read() doesn't work, using a bytes test instead.
+ #while my $chunk = $.connection.socket.read(256)
+ while ! $received
+ {
+ my $chunk = $.connection.socket.read(256);
+ my $bytes = $chunk.bytes;
+ $*ERR.say: "Read $bytes of data." if $debug;
+ if $bytes != 256 { $received = True; }
+ $!request ~= $chunk.decode;
+ }
+ my $rlen = $.request.chars;
my $err = $.connection.err;
if $debug { $*ERR.say: "Receieved request: $.request"; }
if $.request ~~ / ^ (\d+) \: /
@@ -25,7 +35,7 @@ method parse ()
my $offset = $0.Str.chars + 1;
if ($rlen < $length + $offset)
{
- $err.say(SCGI_E_LENGTH);
+ $err.say(SCGI_E_LENGTH ~ " [$rlen/$length+$offset]");
return self;
}
my $env_string = $.request.substr($offset, $length);

0 comments on commit 6be09a9

Please sign in to comment.