Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: x542d44174a72dfe3 [...] f4n.org
Cc:
AdminCc:

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



Subject: Excessively small Streaming size causes header to mix with content?
Date: Fri, 31 Jul 2009 14:31:48 +0200
To: bug-POE-Component-Client-HTTP [...] rt.cpan.org
From: Steve <x542d44174a72dfe3 [...] f4n.org>
Download (untitled) / with headers
text/plain 2.1k
First a warning: I have tested this with POE-Component-Client-HTTP-0.890, but my version of perl is ancient: 5.8.8 (don't laugh). If it works for you then please close the bug. Description: Posting a request with a very small Streaming size causes part of the header to be recognized as content. If the server uses chunked responses, the final "0" chunk is not taken as eof and the request does not finish until it times out. I don't know if there's any real use for such small Streaming sizes, but if the smallest allowed size depends on the server's response, then there is of course a problem anyway. Sample code: #!/usr/bin/perl use POE; use POE::Component::Client::HTTP; use HTTP::Request::Common; POE::Component::Client::HTTP->spawn( Alias => 'ua', Streaming => 30 ); POE::Session->create( inline_states => { _start => \&start, _stop => \&stop, got_data => \&got_data } ); POE::Kernel->run(); sub start { $_[KERNEL]->post( ua => request => got_data => GET( 'http://www.google.com/robots.txt' ) ) } sub stop { print STDERR "stopping\n"; $_[KERNEL]->alias_remove( 'ua' ) } sub got_data { unless ( $_[HEAP]->{printed}++ ) { print STDERR "*** request:\n" . $_[ARG0]->[0]->as_string() . "\n***\n\n"; print STDERR "*** response:\n" . $_[ARG1]->[0]->as_string() . "\n***\n\n"; } print STDERR "*** data:\n" . (defined($_[ARG1]->[1]) ? $_[ARG1]->[1] : "(eof)" ) . "\n***\n\n"; } __END__ Output (cookie has been masked): *** request: GET http://www.google.com/robots.txt HTTP/1.1 Host: www.google.com User-Agent: POE-Component-Client-HTTP/0.890 (perl; N; POE; en; rv:0.890000) *** *** response: HTTP/1.1 200 OK Content-Type: text/plain Last-Modified: Thu, 16 Jul 2009 15:25:04 GMT Set-Cookie: PREF=ID=aaaaaaaaaaaaaaaa:TM=0000000000:LM=0000000000:S=aaaaaaaaaaaaaaaa; expires=Sun, 31-Jul-2011 12:06:10 GMT; path=/; domain=.google.com *** *** data: Date: Fri, 31 Jul 2009 12:06: *** (snip, contains more of the header as well as the real data) *** data: maps_webmasters.xml 0 *** Seeing "Date:" as data is unexpected, and that last "0" is seen because the HTTPChunk filter is never applied. I'm brand new to POE, so sorry for not hunting it down further, or if it's just because of some beginner's mistake on my part.
Download (untitled) / with headers
text/plain 207b
Thank you for the test case. I have finally been able to track down and fix the issue. The fix is in commit 38323e64b15d9e6c8d540bb70ed88a058bfa9453 (github, gitorious) ... and will be in the next release.


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.