Comment

Comment by 1vuio0pswjnm7

I have temporarily forgotten where I got this from but below is a URL test I have used. Perhaps someone here recognises it.

1 indicates valid

   http://foo.com/blah_blah 1 1 1 1 1 1 1 1 1 1 1 1 1
   http://foo.com/blah_blah/ 1 1 1 1 1 1 1 1 1 1 1 1 1
   http://foo.com/blah_blah_(wikipedia) 1 1 1 1 1 1 1 1 1 0 1 1 1
   http://foo.com/blah_blah_(wikipedia)_(again) 1 1 1 1 1 1 1 1 1 0 1 1 1
   http://www.example.com/wpstyle/?p=364 1 1 1 1 1 1 1 1 1 1 1 1 1
   https://www.example.com/foo/?bar=baz&inga=42&quux 1 1 1 1 1 1 1 1 1 1 1 1 1
   http://*df.ws/123 0 0 1 1 1 1 0 1 1 1 1 1 0
   http://userid:[email protected]:8080 0 1 1 1 1 0 1 1 1 1 1 1 1
   http://userid:[email protected]:8080/ 0 1 1 1 1 0 1 1 1 1 1 1 1
   http://[email protected] 0 1 1 1 1 0 1 1 1 1 1 1 1
   http://[email protected]/ 0 1 1 1 1 0 1 1 1 1 1 1 1
   http://[email protected]:8080 0 1 1 1 1 0 1 1 1 1 1 1 1
   http://[email protected]:8080/ 0 1 1 1 1 0 1 1 1 1 1 1 1
   http://userid:[email protected] 0 1 1 1 1 0 1 1 1 1 1 1 1
   http://userid:[email protected]/ 0 1 1 1 1 0 1 1 1 1 1 1 1
   http://142.42.1.1/ 0 1 1 1 1 1 1 1 1 1 1 1 1
   http://142.42.1.1:8080/ 0 1 1 1 1 1 1 1 1 1 1 1 1
   http://**.ws/*** 0 0 1 1 1 0 0 1 1 0 1 1 0
   http://88.ws 0 0 1 1 1 0 0 1 1 1 1 1 0
   http://88.ws/ 0 0 1 1 1 0 0 1 1 1 1 1 0
   http://foo.com/blah_(wikipedia)#cite-1 1 1 1 1 1 1 1 1 1 1 1 1 1
   http://foo.com/blah_(wikipedia)_blah#cite-1 1 1 1 1 1 1 1 1 1 1 1 1 1
   http://foo.com/unicode_(*)_in_parens 1 1 1 1 1 1 0 1 1 1 1 1 0
   http://foo.com/(something)?after=parens 1 1 1 1 1 1 1 1 1 1 1 1 1
   http://:-).damowmow.com/ 0 1 1 1 1 0 0 1 1 1 1 1 0
   http://code.google.com/events/#&product=browser 1 1 1 1 1 1 1 1 1 1 1 1 1
   http://j.mp 1 1 1 1 1 1 1 1 1 1 1 1 1
   ftp://foo.bar/baz 0 0 1 1 1 1 1 1 1 1 1 1 1
   http://foo.bar/?q=Test%20URL-encoded%20stuff 0 1 1 1 1 1 1 1 1 1 1 1 1
   http://m+tka+l+.ahx+t+b+a+r+ 0 0 1 1 1 0 0 1 1 0 1 1 0
   http://******.****** 0 0 1 1 1 0 0 1 1 0 1 1 0
   http://******************.********************* 0 0 1 1 1 0 0 1 1 0 1 1 0
   http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com 0 1 0 1 1 0 0 1 1 1 1 1 1
   http://1337.net 1 1 1 1 1 1 1 1 1 1 1 1 1
   http://a.b-c.de 1 1 1 1 1 1 1 1 1 1 0 1 1
   http://223.255.255.254 0 1 1 1 1 1 1 1 1 1 1 1 1
   https://foo_bar.example.com/ 1 1 1 1 1 1 0 1 1 1 1 0 0
   These URLs should fail (0 -> correct)
   http:// 0 0 0 0 0 0 0 0 1 0 0 0 0
   http://. 0 0 0 0 1 0 1 0 1 0 0 0 0
   http://.. 0 0 0 0 1 0 1 0 1 0 0 0 0
   http://../ 0 1 1 1 1 0 1 0 1 1 0 0 0
   http://? 0 0 0 0 1 0 0 0 1 0 0 0 0
   http://?? 0 0 0 0 1 0 0 0 1 0 0 0 0
   http://??/ 0 1 1 1 1 0 0 0 1 1 0 0 0
   http://# 0 0 0 1 1 0 0 0 1 1 0 0 0
   http://## 0 1 0 1 1 0 0 0 1 1 0 0 0
   http://##/ 0 1 1 1 1 0 0 0 1 1 0 0 0
   http://foo.bar?q=Spaces should be encoded 0 1 1 1 1 1 0 0 1 1 0 0 0
   // 0 0 0 0 0 0 0 0 0 0 0 0 0
   //a 0 0 0 0 0 0 0 0 0 0 0 0 0
   ///a 0 0 0 0 0 0 0 0 0 0 0 0 0
   /// 0 0 0 0 0 0 0 0 0 0 0 0 0
   http:///a 0 1 1 1 1 0 0 0 1 1 0 0 0
   foo.com 0 0 0 0 1 0 0 0 0 0 0 0 0
   rdar://1234 0 0 1 1 1 0 1 0 1 0 0 0 1
   h://test 0 0 1 0 1 0 1 0 1 0 0 0 1
   http:// shouldfail.com 0 0 0 0 1 0 0 0 1 1 0 0 0
   :// should fail 0 0 0 0 0 0 0 0 0 0 0 0 0
   http://foo.bar/foo(bar)baz quux 0 1 1 1 1 1 0 0 1 1 0 0 0
   ftps://foo.bar/ 0 0 1 1 1 0 1 0 1 0 0 0 1
   http://-error-.invalid/ 0 1 1 1 1 1 1 1 1 1 0 0 0
   http://a.b--c.de/ 1 1 1 1 1 1 1 1 1 1 0 0 1
   http://-a.b.co 1 1 1 1 1 1 1 1 1 1 0 0 0
   http://a.b-.co 1 1 1 1 1 1 1 1 1 1 0 0 0
   http://0.0.0.0 0 1 1 1 1 1 1 1 1 1 1 0 1
   http://10.1.1.0 0 1 1 1 1 1 1 1 1 1 1 0 1
   http://10.1.1.255 0 1 1 1 1 1 1 1 1 1 1 0 1
   http://224.1.1.1 0 1 1 1 1 1 1 1 1 1 1 0 1
   http://1.1.1.1.1 0 1 1 1 1 1 1 1 1 1 1 0 1
   http://123.123.123 0 1 1 1 1 1 1 1 1 1 1 0 1
   http://3628126748 0 1 1 1 1 0 1 1 1 1 1 0 1
   http://.www.foo.bar/ 0 1 1 1 1 0 1 0 1 1 0 0 0
   http://www.foo.bar./ 0 1 1 1 1 1 1 1 1 1 1 0 1
   http://.www.foo.bar./ 0 1 1 1 1 0 1 0 1 1 0 0 0
   http://10.1.1.1 0 1 1 1 1 1 1 1 1 1 1 0 1
   http://10.1.1.254 0 1 1 1 1 1 1 1 1 1 1 0 1

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton