Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: kozunov [...] gmail.com
Cc:
AdminCc:

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



Subject: 408 instead of 500
I have two request to the server. When I try to connect to server(server shut down) first request - got response "Connection to localhost:36333 failed: connect error 111: Connection refused", but the second - "Connection to localhost:36333 failed: timeout"
Subject: ht.pl
#!/usr/bin/perl -w use utf8; use strict; use warnings; use Data::Dumper; use POE 1.350; use POE::Component::Client::HTTP 0.944; use POE::Component::Client::Keepalive 0.268; use HTTP::Request::Common qw(GET HEAD); use HTTP::Cookies; $SIG{__WARN__} = sub { my $str = shift; warn scalar(localtime)." $str"; }; my $pool = POE::Component::Client::Keepalive->new( keep_alive => 3, max_open => 1, max_per_host => 2, timeout => 7, resolver => POE::Component::Resolver->new( max_resolvers => 1, idle_timeout => 11, ), ); POE::Component::Client::HTTP->spawn( Alias => 'ua', FollowRedirects => 3, Timeout => 13, MaxSize => 1024, Agent => '', ConnectionManager => $pool, Streaming => 0, CookieJar => HTTP::Cookies->new(), ); foreach my $i (1..2) { POE::Session->create( inline_states => { _start => sub { my $header = [TE => 'chunked,identity', Connection => "close"]; my $domain = 'localhost:36333'; my $url = "http://$domain/$i"; my $request = HTTP::Request->new( 'GET', $url, $header); $poe_kernel->post( "ua" => "request", "response", $request, {domain=>$domain, i => $i}); }, _stop => sub {}, response => \&response, }, ); } POE::Kernel->run(); exit; sub response { my ($request_packet, $response_packet) = @_[ARG0, ARG1]; my $http_request = $request_packet->[0]; my $tag = $request_packet->[1]; my $http_response = $response_packet->[0]; warn Dumper $http_response; }
Thank you for the test case. It helped me resolve this problem: commit 4280200388131e6addec30ab44b5898eadaf9951 Author: Rocco Caputo <rcaputo@cpan.org> Date: Mon May 14 21:40:07 2012 -0400 [rt.cpan.org 76776] Fix an edge case where queued requests don't start. Sergei Kozunov came through with another great ticket. If two requests for the same host arrive, and the first one fails, the second one will time out in the queue. But only if no other requests are already pending. This change wakes up the queue when a connection fails, causing the subsequent request to be processed.