Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: sean [...] brunnock.com
Cc:
AdminCc:

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



Subject: crashes when redirected to invalid URL
I'm using POE-Component-Client-HTTP-0.947 with perl 5.16.3 on CentOS 6.4 . http://planet.naga.ph/feed/ redirects to a URL that starts with "htttp:" The following code crashes and produces a screenful of error messages- use POE qw(Component::Client::HTTP); use HTTP::Request; my (@requests); my $request = HTTP::Request->new(GET => 'http://planet.naga.ph/feed/'); push @requests, $request; POE::Component::Client::HTTP->spawn(Alias => 'ua', FollowRedirects => 1); POE::Session->create(inline_states => { _start => sub { $_[KERNEL]->yield('process_feed') }, process_feed => \&process_feed, process_response => \&process_response } ); sub process_feed { return unless (@requests) and (my $request = pop(@requests)); $_[KERNEL]->post('ua', 'request', 'process_response', $request ); } sub process_response { my $request = $_[ARG0]->[0]; my $response = $_[ARG1]->[0]; printf("URI: %s\t Status Line: %s\n", $request->uri, $response->status_line); $_[KERNEL]->yield('process_feed'); } POE::Kernel->run();
From: sean [...] brunnock.com
I'm able to get around this error by modifying my copy of POE/Component/Client/HTTP/Request.pm . 14a15 Show quoted text
> use Data::Validate::URI qw(is_http_uri);
440c441 < --- Show quoted text
> return undef unless (is_http_uri($location_uri));
Thank you very much for the test case and patch. The confess() was put in place to debug a rare condition we couldn't figure out how to reproduce. I'm glad you found it, as you've been very helpful resolving it. I've committed a much different fix and uploaded version 0.948 to CPAN. I hope it satisfies your requirements. If it doesn't, please let me know.