mIRC Home    About    Download    Register    News    Help

Print Thread
Hyperlink bug when last char is close paren #176408 09/05/07 02:48 PM
Joined: Sep 2003
Posts: 34
K
koitsu Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2003
Posts: 34
Someone in a channel drops a URL like this:

http://www.foobar.com/blah_blah_(foo_foo)

(Which are often common with Wikipedia)

mIRC launches whatever browser you have chosen (doesn't matter if you use IE, Firefox, or Opera), with the following URL:

http://www.foobar.com/blah_blah_(foo_foo

Note the last character getting chopped off. This only happens if the last character is a close parenthesis. Verified to exist in 6.21.

Hope to see this fixed in mIRC 6.22. smile

Re: Hyperlink bug when last char is close paren [Re: koitsu] #176409 09/05/07 03:25 PM
Joined: Jun 2003
Posts: 5,024
M
Mentality Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
See this thread, which is one of many about this "bug". It's not really a bug afaik.

Regards,


Mentality/Chris
Re: Hyperlink bug when last char is close paren [Re: Mentality] #176543 11/05/07 03:20 AM
Joined: Sep 2003
Posts: 34
K
koitsu Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Sep 2003
Posts: 34
I read the URL you provided, and a lot of assumptions were made, but a full range of tests weren't applied.

The example given in the last post is to use the escaped version of open and close parens, which are %28 and %29. RFC 2396 explicitly states that open/close paren are not considered reserved characters, thus they should not be escaped (escaped in English means "converted into those funky %xx sequences"). So using %28 and %29, although gets handled by URI parsers just fine, is not adherent to the RFC. If you want double confirmation of this, I'll be glad to show it with some perl scripting using URI::Escape, which is RFC-compliant:

Code:
use URI::Escape;
print uri_escape("http://blahblah.com/(keke)");
print "\n";


results in:

Code:
http%3A%2F%2Fblahblah.com%2F(keke)


This is because colon (:) and solidus (/) are deemed reserved according to RFC 2396. Note, however, that ( and ) are not escaped.

Now that I've covered that base, back to the core problem.

mIRC is trying to be "smart" about removing parenthesis for URLs, which is where the problem lies. The logic is broken, as I'll show below. Here's a chart of what mIRC does (tested/confirmed):

Code:
mIRC string                    Browser URL
http://blahblah.com/keke       http://blahblah.com/keke
http://blahblah.com/keke)      http://blahblah.com/keke
http://blahblah.com/(keke)     http://blahblah.com/(keke
(http://blahblah.com/keke)     http://blahblah.com/keke
(http://blahblah.com/(keke))   http://blahblah.com/(keke)
(http://blahblah.com/((keke))  http://blahblah.com/((keke)


The 2nd and 3rd examples are downright wrong (bugs). The trailing paren is being removed erroneously in the 2nd example, and the same for the 3rd example.

The code should be changed to only remove the initial and trailing parens if they both exist, and are the first and last characters of the string respectively. This is what mIRC is *trying* to do, but is broken.

Proper behaviour would be:

Code:
mIRC string                    Browser
http://blahblah.com/keke       http://blahblah.com/keke
http://blahblah.com/keke)      http://blahblah.com/keke)
http://blahblah.com/(keke)     http://blahblah.com/(keke)
(http://blahblah.com/keke)     http://blahblah.com/keke
(http://blahblah.com/(keke))   http://blahblah.com/(keke)
(http://blahblah.com/((keke))  http://blahblah.com/((keke)


Have I made this issue clear enough? :-) It's a bug.

Last edited by koitsu; 11/05/07 03:22 AM.
Re: Hyperlink bug when last char is close paren [Re: koitsu] #176551 11/05/07 10:52 AM
Joined: Jun 2003
Posts: 5,024
M
Mentality Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
Yeah, I've seen all of that information before, it's all been posted before at one point or another. The RFCs have been illustrated with obsessive care and attention, and Khaled has been made aware of the issue.

As far as I remember some changes were made in recent versions to improve the "logic" behind mIRC's hotlink interpretation (don't quote me though), so maybe more changes will be made in the future.

Regards,


Mentality/Chris