4 ms·
If you're going to allow dotted IPs you should really allow 32-bit IPs too, e.g., http://0xadc229b7 http://0xadc229b7, http://2915183031 http://2915183031 and h
by to3m 12y ago
If you're going to allow dotted IPs you should really allow 32-bit IPs too, e.g., http://0xadc229b7 http://0xadc229b7, http://2915183031 http://2915183031 and http://025560424667 http://025560424667. (The validity of this last one was news to me I must admit.)
- DanBlake 12y agoYep. I should mention that 99.9% of domains will fall into standard form ( handle.domain or ip.ip.ip.ip ) As such, You are definitely more likely to let a user enter a bad URL they did not intend because it validates then to let a uncommon domain actually be used. As such- a much simpler regex would likely 'make more people happy' than being 100% correct to tech spec.
- baddox 12y agoAlso IPv6 URLs, like http://[1080:0:0:0:8:800:200C:417A]/index.html http://[1080:0:0:0:8:800:200C:417A]/index.html http://www.ietf.org/rfc/rfc2732.txt http://www.ietf.org/rfc/rfc2732.txt
- gamegoblin 12y agoSince I just finished implementing a toy HTTP/1.1 server, I must throw in my newfound knowledge that 2732 has been updated with Zone IDs: http://tools.ietf.org/html/rfc6874 http://tools.ietf.org/html/rfc6874
- zAy0LfpBZLC8mAC 12y agoNone of those is a URI, so a URI validator most certainly should not accept them. Just because browsers tend to understand them as a matter of a historical accident does not mean those are valid URIs, just as tag soup that browsers also tend to understand isn't valid HTML either.