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