urltestdata.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. # This file is from https://github.com/w3c/web-platform-tests/blob/master/url/urltestdata.txt
  2. # and used under a 3-clause BSD license.
  3. # FORMAT NOT DOCUMENTED YET (parser is urltestparser.js)
  4. # https://github.com/w3c/web-platform-tests/blob/master/url/urltestparser.js
  5. # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments.js
  6. http://example\t.\norg http://example.org/foo/bar s:http h:example.org p:/
  7. http://user:pass@foo:21/bar;par?b#c s:http u:user pass:pass h:foo port:21 p:/bar;par q:?b f:#c
  8. http:foo.com s:http h:example.org p:/foo/foo.com
  9. \t\s\s\s:foo.com\s\s\s\n s:http h:example.org p:/foo/:foo.com
  10. \sfoo.com\s\s s:http h:example.org p:/foo/foo.com
  11. a:\t\sfoo.com s:a p:\sfoo.com
  12. http://f:21/\sb\s?\sd\s#\se\s s:http h:f port:21 p:/%20b%20 q:?%20d%20 f:#\se
  13. http://f:/c s:http h:f p:/c
  14. http://f:0/c s:http h:f port:0 p:/c
  15. http://f:00000000000000/c s:http h:f port:0 p:/c
  16. http://f:00000000000000000000080/c s:http h:f p:/c
  17. http://f:b/c
  18. http://f:\s/c
  19. http://f:\n/c s:http h:f p:/c
  20. http://f:fifty-two/c
  21. http://f:9999/c s:http h:f port:9999 p:/c
  22. http://f:\s21\s/\sb\s?\sd\s#\se\s
  23. s:http h:example.org p:/foo/bar
  24. \s\s\t s:http h:example.org p:/foo/bar
  25. :foo.com/ s:http h:example.org p:/foo/:foo.com/
  26. :foo.com\\ s:http h:example.org p:/foo/:foo.com/
  27. : s:http h:example.org p:/foo/:
  28. :a s:http h:example.org p:/foo/:a
  29. :/ s:http h:example.org p:/foo/:/
  30. :\\ s:http h:example.org p:/foo/:/
  31. :# s:http h:example.org p:/foo/: f:#
  32. # s:http h:example.org p:/foo/bar f:#
  33. #/ s:http h:example.org p:/foo/bar f:#/
  34. #\\ s:http h:example.org p:/foo/bar f:#\\
  35. #;? s:http h:example.org p:/foo/bar f:#;?
  36. ? s:http h:example.org p:/foo/bar q:?
  37. / s:http h:example.org p:/
  38. :23 s:http h:example.org p:/foo/:23
  39. /:23 s:http h:example.org p:/:23
  40. :: s:http h:example.org p:/foo/::
  41. ::23 s:http h:example.org p:/foo/::23
  42. foo:// s:foo p:/
  43. http://a:b@c:29/d s:http u:a pass:b h:c port:29 p:/d
  44. http::@c:29 s:http h:example.org p:/foo/:@c:29
  45. http://&a:foo(b]c@d:2/ s:http u:&a pass:foo(b%5Dc h:d port:2 p:/
  46. http://::@c@d:2 s:http pass:%3A%40c h:d port:2 p:/
  47. http://foo.com:b@d/ s:http u:foo.com pass:b h:d p:/
  48. http://foo.com/\\@ s:http h:foo.com p://@
  49. http:\\\\foo.com\\ s:http h:foo.com p:/
  50. http:\\\\a\\b:c\\d@foo.com\\ s:http h:a p:/b:c/d@foo.com/
  51. foo:/ s:foo p:/
  52. foo:/bar.com/ s:foo p:/bar.com/
  53. foo:///////// s:foo p:///////
  54. foo://///////bar.com/ s:foo p:///////bar.com/
  55. foo:////:///// s:foo p://://///
  56. c:/foo s:c p:/foo
  57. //foo/bar s:http h:foo p:/bar
  58. http://foo/path;a??e#f#g s:http h:foo p:/path;a q:??e f:#f#g
  59. http://foo/abcd?efgh?ijkl s:http h:foo p:/abcd q:?efgh?ijkl
  60. http://foo/abcd#foo?bar s:http h:foo p:/abcd f:#foo?bar
  61. [61:24:74]:98 s:http h:example.org p:/foo/[61:24:74]:98
  62. http:[61:27]/:foo s:http h:example.org p:/foo/[61:27]/:foo
  63. http://[1::2]:3:4
  64. http://2001::1
  65. http://2001::1]
  66. http://2001::1]:80
  67. http://[2001::1] s:http h:[2001::1] p:/
  68. http://[2001::1]:80 s:http h:[2001::1] p:/
  69. http:/example.com/ s:http h:example.org p:/example.com/
  70. ftp:/example.com/ s:ftp h:example.com p:/
  71. https:/example.com/ s:https h:example.com p:/
  72. madeupscheme:/example.com/ s:madeupscheme p:/example.com/
  73. file:/example.com/ s:file p:/example.com/
  74. ftps:/example.com/ s:ftps p:/example.com/
  75. gopher:/example.com/ s:gopher h:example.com p:/
  76. ws:/example.com/ s:ws h:example.com p:/
  77. wss:/example.com/ s:wss h:example.com p:/
  78. data:/example.com/ s:data p:/example.com/
  79. javascript:/example.com/ s:javascript p:/example.com/
  80. mailto:/example.com/ s:mailto p:/example.com/
  81. http:example.com/ s:http h:example.org p:/foo/example.com/
  82. ftp:example.com/ s:ftp h:example.com p:/
  83. https:example.com/ s:https h:example.com p:/
  84. madeupscheme:example.com/ s:madeupscheme p:example.com/
  85. ftps:example.com/ s:ftps p:example.com/
  86. gopher:example.com/ s:gopher h:example.com p:/
  87. ws:example.com/ s:ws h:example.com p:/
  88. wss:example.com/ s:wss h:example.com p:/
  89. data:example.com/ s:data p:example.com/
  90. javascript:example.com/ s:javascript p:example.com/
  91. mailto:example.com/ s:mailto p:example.com/
  92. /a/b/c s:http h:example.org p:/a/b/c
  93. /a/\s/c s:http h:example.org p:/a/%20/c
  94. /a%2fc s:http h:example.org p:/a%2fc
  95. /a/%2f/c s:http h:example.org p:/a/%2f/c
  96. #\u03B2 s:http h:example.org p:/foo/bar f:#\u03B2
  97. data:text/html,test#test s:data p:text/html,test f:#test
  98. # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/file.html
  99. file:c:\\foo\\bar.html file:///tmp/mock/path s:file p:/c:/foo/bar.html
  100. \s\sFile:c|////foo\\bar.html s:file p:/c:////foo/bar.html
  101. C|/foo/bar s:file p:/C:/foo/bar
  102. /C|\\foo\\bar s:file p:/C:/foo/bar
  103. //C|/foo/bar s:file p:/C:/foo/bar
  104. //server/file s:file h:server p:/file
  105. \\\\server\\file s:file h:server p:/file
  106. /\\server/file s:file h:server p:/file
  107. file:///foo/bar.txt s:file p:/foo/bar.txt
  108. file:///home/me s:file p:/home/me
  109. // s:file p:/
  110. /// s:file p:/
  111. ///test s:file p:/test
  112. file://test s:file h:test p:/
  113. file://localhost s:file p:/
  114. file://localhost/ s:file p:/
  115. file://localhost/test s:file p:/test
  116. test s:file p:/tmp/mock/test
  117. file:test s:file p:/tmp/mock/test
  118. # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path.js
  119. http://example.com/././foo about:blank s:http h:example.com p:/foo
  120. http://example.com/./.foo s:http h:example.com p:/.foo
  121. http://example.com/foo/. s:http h:example.com p:/foo/
  122. http://example.com/foo/./ s:http h:example.com p:/foo/
  123. http://example.com/foo/bar/.. s:http h:example.com p:/foo/
  124. http://example.com/foo/bar/../ s:http h:example.com p:/foo/
  125. http://example.com/foo/..bar s:http h:example.com p:/foo/..bar
  126. http://example.com/foo/bar/../ton s:http h:example.com p:/foo/ton
  127. http://example.com/foo/bar/../ton/../../a s:http h:example.com p:/a
  128. http://example.com/foo/../../.. s:http h:example.com p:/
  129. http://example.com/foo/../../../ton s:http h:example.com p:/ton
  130. http://example.com/foo/%2e s:http h:example.com p:/foo/
  131. http://example.com/foo/%2e%2 s:http h:example.com p:/foo/%2e%2
  132. http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar s:http h:example.com p:/%2e.bar
  133. http://example.com////../.. s:http h:example.com p://
  134. http://example.com/foo/bar//../.. s:http h:example.com p:/foo/
  135. http://example.com/foo/bar//.. s:http h:example.com p:/foo/bar/
  136. http://example.com/foo s:http h:example.com p:/foo
  137. http://example.com/%20foo s:http h:example.com p:/%20foo
  138. http://example.com/foo% s:http h:example.com p:/foo%
  139. http://example.com/foo%2 s:http h:example.com p:/foo%2
  140. http://example.com/foo%2zbar s:http h:example.com p:/foo%2zbar
  141. http://example.com/foo%2\u00C2\u00A9zbar s:http h:example.com p:/foo%2%C3%82%C2%A9zbar
  142. http://example.com/foo%41%7a s:http h:example.com p:/foo%41%7a
  143. http://example.com/foo\t\u0091%91 s:http h:example.com p:/foo%C2%91%91
  144. http://example.com/foo%00%51 s:http h:example.com p:/foo%00%51
  145. http://example.com/(%28:%3A%29) s:http h:example.com p:/(%28:%3A%29)
  146. http://example.com/%3A%3a%3C%3c s:http h:example.com p:/%3A%3a%3C%3c
  147. http://example.com/foo\tbar s:http h:example.com p:/foobar
  148. http://example.com\\\\foo\\\\bar s:http h:example.com p://foo//bar
  149. http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd s:http h:example.com p:/%7Ffp3%3Eju%3Dduvgw%3Dd
  150. http://example.com/@asdf%40 s:http h:example.com p:/@asdf%40
  151. http://example.com/\u4F60\u597D\u4F60\u597D s:http h:example.com p:/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD
  152. http://example.com/\u2025/foo s:http h:example.com p:/%E2%80%A5/foo
  153. http://example.com/\uFEFF/foo s:http h:example.com p:/%EF%BB%BF/foo
  154. http://example.com/\u202E/foo/\u202D/bar s:http h:example.com p:/%E2%80%AE/foo/%E2%80%AD/bar
  155. # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/relative.js
  156. http://www.google.com/foo?bar=baz# about:blank s:http h:www.google.com p:/foo q:?bar=baz f:#
  157. http://www.google.com/foo?bar=baz#\s\u00BB s:http h:www.google.com p:/foo q:?bar=baz f:#\s%C2%BB
  158. http://[www.google.com]/
  159. http://www.google.com s:http h:www.google.com p:/
  160. http://192.0x00A80001 s:http h:192.168.0.1 p:/
  161. http://www/foo%2Ehtml s:http h:www p:/foo%2Ehtml
  162. http://www/foo/%2E/html s:http h:www p:/foo/html
  163. http://user:pass@/
  164. http://%25DOMAIN:foobar@foodomain.com/ s:http u:%25DOMAIN pass:foobar h:foodomain.com p:/
  165. http:\\\\www.google.com\\foo s:http h:www.google.com p:/foo
  166. http://foo:80/ s:http h:foo p:/
  167. http://foo:81/ s:http h:foo port:81 p:/
  168. httpa://foo:80/ s:httpa h:foo port:80 p:/
  169. http://foo:-80/
  170. https://foo:443/ s:https h:foo p:/
  171. https://foo:80/ s:https h:foo port:80 p:/
  172. ftp://foo:21/ s:ftp h:foo p:/
  173. ftp://foo:80/ s:ftp h:foo port:80 p:/
  174. gopher://foo:70/ s:gopher h:foo p:/
  175. gopher://foo:443/ s:gopher h:foo port:443 p:/
  176. ws://foo:80/ s:ws h:foo p:/
  177. ws://foo:81/ s:ws h:foo port:81 p:/
  178. ws://foo:443/ s:ws h:foo port:443 p:/
  179. ws://foo:815/ s:ws h:foo port:815 p:/
  180. wss://foo:80/ s:wss h:foo port:80 p:/
  181. wss://foo:81/ s:wss h:foo port:81 p:/
  182. wss://foo:443/ s:wss h:foo p:/
  183. wss://foo:815/ s:wss h:foo port:815 p:/
  184. http:/example.com/ s:http h:example.com p:/
  185. ftp:/example.com/ s:ftp h:example.com p:/
  186. https:/example.com/ s:https h:example.com p:/
  187. madeupscheme:/example.com/ s:madeupscheme p:/example.com/
  188. file:/example.com/ s:file p:/example.com/
  189. ftps:/example.com/ s:ftps p:/example.com/
  190. gopher:/example.com/ s:gopher h:example.com p:/
  191. ws:/example.com/ s:ws h:example.com p:/
  192. wss:/example.com/ s:wss h:example.com p:/
  193. data:/example.com/ s:data p:/example.com/
  194. javascript:/example.com/ s:javascript p:/example.com/
  195. mailto:/example.com/ s:mailto p:/example.com/
  196. http:example.com/ s:http h:example.com p:/
  197. ftp:example.com/ s:ftp h:example.com p:/
  198. https:example.com/ s:https h:example.com p:/
  199. madeupscheme:example.com/ s:madeupscheme p:example.com/
  200. ftps:example.com/ s:ftps p:example.com/
  201. gopher:example.com/ s:gopher h:example.com p:/
  202. ws:example.com/ s:ws h:example.com p:/
  203. wss:example.com/ s:wss h:example.com p:/
  204. data:example.com/ s:data p:example.com/
  205. javascript:example.com/ s:javascript p:example.com/
  206. mailto:example.com/ s:mailto p:example.com/
  207. # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/segments-userinfo-vs-host.html
  208. http:@www.example.com about:blank s:http h:www.example.com p:/
  209. http:/@www.example.com s:http h:www.example.com p:/
  210. http://@www.example.com s:http h:www.example.com p:/
  211. http:a:b@www.example.com s:http u:a pass:b h:www.example.com p:/
  212. http:/a:b@www.example.com s:http u:a pass:b h:www.example.com p:/
  213. http://a:b@www.example.com s:http u:a pass:b h:www.example.com p:/
  214. http://@pple.com s:http h:pple.com p:/
  215. http::b@www.example.com s:http pass:b h:www.example.com p:/
  216. http:/:b@www.example.com s:http pass:b h:www.example.com p:/
  217. http://:b@www.example.com s:http pass:b h:www.example.com p:/
  218. http:/:@/www.example.com
  219. http://user@/www.example.com
  220. http:@/www.example.com
  221. http:/@/www.example.com
  222. http://@/www.example.com
  223. https:@/www.example.com
  224. http:a:b@/www.example.com
  225. http:/a:b@/www.example.com
  226. http://a:b@/www.example.com
  227. http::@/www.example.com
  228. http:a:@www.example.com s:http u:a pass: h:www.example.com p:/
  229. http:/a:@www.example.com s:http u:a pass: h:www.example.com p:/
  230. http://a:@www.example.com s:http u:a pass: h:www.example.com p:/
  231. http://www.@pple.com s:http u:www. h:pple.com p:/
  232. http:@:www.example.com
  233. http:/@:www.example.com
  234. http://@:www.example.com
  235. http://:@www.example.com s:http pass: h:www.example.com p:/
  236. #Others
  237. / http://www.example.com/test s:http h:www.example.com p:/
  238. /test.txt s:http h:www.example.com p:/test.txt
  239. . s:http h:www.example.com p:/
  240. .. s:http h:www.example.com p:/
  241. test.txt s:http h:www.example.com p:/test.txt
  242. ./test.txt s:http h:www.example.com p:/test.txt
  243. ../test.txt s:http h:www.example.com p:/test.txt
  244. ../aaa/test.txt s:http h:www.example.com p:/aaa/test.txt
  245. ../../test.txt s:http h:www.example.com p:/test.txt
  246. \u4E2D/test.txt s:http h:www.example.com p:/%E4%B8%AD/test.txt
  247. http://www.example2.com s:http h:www.example2.com p:/
  248. # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html
  249. # Basic canonicalization, uppercase should be converted to lowercase
  250. http://ExAmPlE.CoM http://other.com/ s:http p:/ h:example.com
  251. # Spaces should fail
  252. http://example\sexample.com
  253. # This should fail
  254. http://Goo%20\sgoo%7C|.com
  255. # This should fail
  256. http://GOO\u00a0\u3000goo.com
  257. # This should fail
  258. http://[]
  259. http://[:]
  260. # Other types of space (no-break, zero-width, zero-width-no-break) are
  261. # name-prepped away to nothing.
  262. http://GOO\u200b\u2060\ufeffgoo.com s:http p:/ h:googoo.com
  263. # Ideographic full stop (full-width period for Chinese, etc.) should be
  264. # treated as a dot.
  265. http://www.foo\u3002bar.com s:http p:/ h:www.foo.bar.com
  266. # Invalid unicode characters should fail...
  267. http://\ufdd0zyx.com
  268. # ...This is the same as previous but with with escaped.
  269. http://%ef%b7%90zyx.com
  270. # Test name prepping, fullwidth input should be converted to ASCII and NOT
  271. # IDN-ized. This is "Go" in fullwidth UTF-8/UTF-16.
  272. http://\uff27\uff4f.com s:http p:/ h:go.com
  273. # URL spec forbids the following.
  274. # https://www.w3.org/Bugs/Public/show_bug.cgi?id=24257
  275. http://\uff05\uff14\uff11.com
  276. http://%ef%bc%85%ef%bc%94%ef%bc%91.com
  277. # ...%00 in fullwidth should fail (also as escaped UTF-8 input)
  278. http://\uff05\uff10\uff10.com
  279. http://%ef%bc%85%ef%bc%90%ef%bc%90.com
  280. # Basic IDN support, UTF-8 and UTF-16 input should be converted to IDN
  281. http://\u4f60\u597d\u4f60\u597d s:http p:/ h:xn--6qqa088eba
  282. # Invalid escaped characters should fail and the percents should be
  283. # escaped. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24191
  284. http://%zz%66%a.com
  285. # If we get an invalid character that has been escaped.
  286. http://%25
  287. http://hello%00
  288. # Escaped numbers should be treated like IP addresses if they are.
  289. http://%30%78%63%30%2e%30%32%35%30.01 s:http p:/ h:192.168.0.1
  290. http://%30%78%63%30%2e%30%32%35%30.01%2e s:http p:/ h:192.168.0.1
  291. # Invalid escaping should trigger the regular host error handling.
  292. http://%3g%78%63%30%2e%30%32%35%30%2E.01
  293. # Something that isn't exactly an IP should get treated as a host and
  294. # spaces escaped.
  295. http://192.168.0.1\shello
  296. # Fullwidth and escaped UTF-8 fullwidth should still be treated as IP.
  297. # These are "0Xc0.0250.01" in fullwidth.
  298. http://\uff10\uff38\uff43\uff10\uff0e\uff10\uff12\uff15\uff10\uff0e\uff10\uff11 s:http p:/ h:192.168.0.1
  299. # Broken IP addresses.
  300. http://192.168.0.257
  301. http://[google.com]