From: "RubyTalk@..." Date: 2007-08-30T05:17:07+09:00 Subject: Re: Bug in URI.parse? If it is a bug change toplabel in common.rb to this TOPLABEL = "(?:[#{ALNUM}](?:[-#{ALNUM}]*[#{ALNUM}])?)" Thanks to my friendly MySQL admin . Stephen Becker IV On 8/29/07, John Joyce wrote: > I wouldn't call it a bug exactly, it does do what it is written to do. > Instead, let's just say that URI.parse isn't very robust. > It doesn't handle lots of real-world situations in ways you would > expect. > You would expect some sort of message saying the TLD (top level > domain) is missing or bad, but also you would not expect this to end > your program abruptly. > > A good URI parser will also accept IP addresses, since those are also > valid, at least in the sense that they are real and do exist and are > likely to be used or entered by users. > Another problem is the way it handles URLs missing the www or http:// > or https:// > While strictly speaking this should be required, it clearly is not > the reality of URLs in the world or the reality of how humans use > them. People have become accustomed to using what are officially > partial or bad URLs. > > Most web browsers will accept a simple string and attempt to find it, > even if it means adding a TLD. > > ARPANET is pretty pointless now. > > I've begun my own script to check if a URL is correct, but only if it > is the human readable variety. > One of the biggest problems becomes the transitory nature of URLs. > They can change or disappear without notice. > Another problem is the path after a TLD. The path can be nearly > anything and can only be determined to be the first single / after > the apparent TLD. > >