Skip Menu |

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

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

People
Owner: RCAPUTO [...] cpan.org
Requestors: xantus+cpan [...] xantus.org
Cc:
AdminCc:

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



Subject: Zero length content header causes request to not post back
The test case attached GET's a url with Content-Length: 0 header. Zero length content is unchecked in HTTP.pm poco_weeble_io_read. The return at the bottom of the if block near line 464 has the effect of not posting back the response. If checks are added, and that return moved, then line 53 of HTTPHead.pm (return [undef];) causes $input to be undef on the next call to poco_weeble_io_read.
#!/usr/bin/perl # test case for Client::HTTP no content bug use POE qw(Component::Client::HTTP); use HTTP::Request::Common qw(GET); POE::Component::Client::HTTP->spawn( Alias => 'ua' ); POE::Session->create( inline_states => { _start => sub { # get url that has 0 length content $_[KERNEL]->post( 'ua', # posts to the 'ua' alias 'request', # posts to ua's 'request' state 'response', # which of our states will receive the response GET 'http://xantus.org/no_content.html' ); print "request sent\n"; }, response => sub { my ($request_packet, $response_packet) = @_[ARG0, ARG1]; # HTTP::Request my $request_object = $request_packet->[0]; # HTTP::Response my $response_object = $response_packet->[0]; print( "*" x 78, "\n", "*** my request:\n", "-" x 78, "\n", $request_object->as_string(), "*" x 78, "\n", "*** their response:\n", "-" x 78, "\n", $response_object->as_string(), ); print "*" x 78, "\n"; }, _stop => sub { print "session stopped. You should have recieved a response.\n" }, } ); $poe_kernel->run();
I've just committed a fix. Thanks for the test case. I've revised it to use Test::More and point at poe.perl.org, and it's now t/50_davis_zerolength.t, so this sort of thing shouldn't happen again. :)