Permalink
Browse files

If no CONTENT_LENGTH, by default, don't try to read it.

  • Loading branch information...
1 parent 2fe3ee9 commit e291ef60412337685339a870a743a4467571fc08 Timothy Totten committed Nov 6, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/HTTP/Easy.pm6
View
@@ -14,6 +14,9 @@ has %.env; ## The environment, generated by run().
has $.http-protocol; ## The HTTP version being used.
has $.body; ## Any request body, populated by run().
+## If set to true, we will read the body even if there is no CONTENT_LENGTH.
+has Bool $.always-get-body = False;
+
constant CRLF = "\x0D\x0A";
constant DEFAULT_PROTOCOL = 'HTTP/1.0';
@@ -103,7 +106,7 @@ method run
# if $.debug { message("Got body: "~$!body.decode); }
}
}
- else
+ elsif $.always-get-body
{
## No content length. Keep reading until no data is sent.
while my $read = $!connection.read(1024)

0 comments on commit e291ef6

Please sign in to comment.