Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the URI-Find CPAN distribution.

Report information
The Basics
Id: 71153
Status: resolved
Priority: 0/
Queue: URI-Find

People
Owner: Nobody in particular
Requestors: carl.a.chambers [...] gmail.com
Cc:
AdminCc:

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



Subject: If find() dies URI::URL::strict isn't returned to its original state
When find() is called, URI::Find forces URI::URL to be strict globally using URI::URL::strict(1) and then later restores strict back to its original value. If something goes wrong within find, such as the callback throwing an exception, or some other unrelated issue, then strict is never returned back to its original value. The issue rears its head when using this module in an environment where modules are preloaded, such as in a web application. The result is some pretty unexpected issues when you rely on URI being able to handle unsupported schemes elsewhere in an application. It's also quite tricky to debug. Happy to supply a patch, but I'm uncertain if there's another reason behind this behaviour.
Ouch, nice catch. That's definitely a bug. A patch would be most welcome.
Subject: Fwd: Re: [rt.cpan.org #71153] If find() dies URI::URL::strict isn't returned to its original state
Date: Thu, 03 Nov 2011 11:29:22 -0700
To: bug-URI-Find [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Show quoted text
-------- Original Message -------- Subject: Re: [rt.cpan.org #71153] If find() dies URI::URL::strict isn't returned to its original state Date: Mon, 31 Oct 2011 17:17:02 +0000 From: Carl Chambers <carlachambers@gmail.com> To: schwern@pobox.com Hi there, In relation to the following bug: https://rt.cpan.org/Public/Bug/Display.html?id=71153. Sorry that it has taken me a while to get back to you! I have been going around the houses with this a bit, and I don't think there's a nice fix without some kind of change to URI::URL. In order to fix it directly within your class, the call to make URI::URL strict would need to be changed to local $URI::URL::STRICT = 1 and remove the call to reset the value, which is using URI::URL's internals. I'm not sure if that's acceptable enough for you? If it is a patch is attached. Thanks, Carl

Message body is not shown because sender requested not to inline it.

Hmm. Using URI::URL is already discouraged, I'd rather not compound that by grabbing at its guts. A cleaner solution would be to wrap find() in an eval. In fact, find() doesn't have to be wrapped, just _is_uri(). I'll do that now. There's no response about adding a strict mode to URI. https://rt.cpan.org/Ticket/Display.html?id=71204 A patch would probably help move things.