Subject: | "incomplete response b" error when using MaxSize option |
It seems that POE::Component::Client::HTTP::Request::add_eof erronously
generates a 400 "incomplete response b" error when all of the following
conditions are met.
1) MaxSize options is used
2) response includes a Content-Length header
3) Content-Length > MaxSize
For detail, please see the attached patch.
Subject: | PoCoCl-HTTP-Request.pm.MaxSize.patch |
--- /usr/local/lib/perl5/site_perl/5.8.8/POE/Component/Client/HTTP/Request.pm Sun Feb 4 14:25:29 2007
+++ POE/Component/Client/HTTP/Request.pm Wed May 2 05:50:50 2007
@@ -12,7 +12,7 @@
# Unique request ID, independent of wheel and timer IDs.
my $request_seq = 0;
-use constant DEBUG => 0;
+use constant DEBUG => 1;
use constant REQ_ID => 0;
use constant REQ_POSTBACK => 1;
@@ -218,11 +218,16 @@
# ignore content for HEAD requests. This may thwart keep-alive,
# however.
+ my $expected = $self->[REQ_FACTORY]->max_response_size;
+ $expected = $self->[REQ_RESPONSE]->content_length
+ if
+ not defined $expected or
+ $self->[REQ_RESPONSE]->content_length < $expected;
if (
$self->[REQ_REQUEST]->method() ne "HEAD" and
defined $self->[REQ_RESPONSE]->content_length and
not defined $self->[REQ_RESPONSE]->header("Transfer-Encoding") and
- $self->[REQ_OCTETS_GOT] < $self->[REQ_RESPONSE]->content_length
+ $self->[REQ_OCTETS_GOT] < $expected
) {
DEBUG and warn(
"got " . $self->[REQ_OCTETS_GOT] . " of " .