Skip Menu |

This queue is for tickets about the Net-Async-HTTP CPAN distribution.

Report information
The Basics
Id: 73390
Status: resolved
Priority: 0/
Queue: Net-Async-HTTP

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc: kiyoshi.aman [...] gmail.com
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.13
Fixed in: 0.15



Subject: Buggy EOF handling behaviour around connection caching/reuse
If the (cached) connection happens to be at EOF condition but the response reader hasn't read this far yet, the next use of that connection fails with Connection closed while awaiting header Unclear quite how to handle this case, and also the related problems of SIGPIPE from writing to it. Needs more unit tests and fixing. -- Paul Evans
Attached patch should fix it. -- Paul Evans
Subject: rt73390.patch
=== modified file 'lib/Net/Async/HTTP/Protocol.pm' --- lib/Net/Async/HTTP/Protocol.pm 2011-12-25 00:30:20 +0000 +++ lib/Net/Async/HTTP/Protocol.pm 2012-01-17 16:41:18 +0000 @@ -146,7 +146,8 @@ } my $transfer_encoding = $header->header( "Transfer-Encoding" ); - my $content_length = $header->content_length; + my $connection = lc( $header->header( "Connection" ) || "close" ); + my $content_length = $header->content_length; if( defined $transfer_encoding and $transfer_encoding eq "chunked" ) { my $chunk_length; @@ -226,6 +227,7 @@ if( $content_length == 0 ) { $self->debug_printf( "BODY done" ); + $self->close if $connection eq "close"; $on_body_chunk->(); return undef; }
This and more fixes were applied in 0.15, now on CPAN. -- Paul Evans