tokuhirom/p5-Furl — Issue #33: IDN resolution may raise an exception
Author: lestrrat
Created: 2011-10-21 03:39:44+00:00
State: open

https://github.com/tokuhirom/p5-Furl/blob/master/lib/Furl/HTTP.pm#L247

When you resolve hostnames via IDN, this method may throw an exception.
.... Which would be OK, except since it's Furl, I fully expected this to work:

my (undef, $code) = $furl->get( "http://some-host-that-needs-IDN-resolution" );
if ( ! HTTP::Status::is_success($code) ) {
warn "Error!";
return;
}

But since IDN raises an exception, we need to do

my (undef, $code) = eval { $furl->get( "http://some-host-that-needs-IDN-resolution" ) };
if ( $@ || ! HTTP::Status::is_success($code) ) {
warn "Error!";
return;
}

Perhaps the call to IDN resolution should be wrapped in an eval, and an appropriate 500 response should be returned?