Skip Menu |
 

This queue is for tickets about the POE-Component-Client-HTTP CPAN distribution.

Report information
The Basics
Id: 20975
Status: resolved
Priority: 0/
Queue: POE-Component-Client-HTTP

People
Owner: Nobody in particular
Requestors: bitcard [...] abcdatos.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: POE::Component::Client::HTTP::Request return Error 400 when getting limited length content
Download (untitled) / with headers
text/plain 1.1k
I'm getting an HTTP response "Error 400" coming from subroutine add_eof of POE::Component::Client::HTTP::Request.pm when I'm using POE::Component::Client::HTTP v0.77 with GET method and a MaxSize value lower than the full document's size defined. The code wich cause it is in the subroutine add_eof: 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 ) { DEBUG and warn( "got " . $self->[REQ_OCTETS_GOT] . " of " . $self->[REQ_RESPONSE]->content_length ); $self->error(400, "incomplete response " . $self->[REQ_ID]); } I don't fully understand how it works and what is this triying to do, but deactivating this part of code, and letting only the "else", all is running fine, correct HTTP response received is returned. This is running under Win XP SP2 fully updated with ActivePerl v5.8.8. I think is not a OS/Perl issue, and I don't know which more information you may need, I'm very novice in POE. Great job, thank you!
Download (untitled) / with headers
text/plain 678b
Thanks for the bug report. You will probably find it unacceptable, but I have "fixed" your issue by changing the failure status code from 400 (Bad Request) to 406 (Not Acceptable). You have specified a maximum response size, and the remote host's response is larger than that size. It's therefore not an accepable response. If you wish to limit the size of a server response, consider using an HTTP range header instead of a hard response limit. Perhaps you can use both: The HTTP range header to advise the server to send a certain amount of data, and MaxSize to enforce the limit should the server go over. Either way, the limiting code is valid and will not be removed.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.