1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* (c) Markus Lanthaler <[email protected]> |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace ML\IRI\Test; |
11
|
|
|
|
12
|
|
|
use ML\IRI\IRI; |
13
|
|
|
use PHPUnit\Framework\TestCase; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* The IRI test suite. |
17
|
|
|
* |
18
|
|
|
* @author Markus Lanthaler <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
class IriTest extends TestCase |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* Test parsing |
24
|
|
|
* |
25
|
|
|
* This test checks whether decomposing IRIs in their subcomponents works. |
26
|
|
|
* |
27
|
|
|
* @param string $iri The IRI to decompose. |
28
|
|
|
* @param string|null $scheme The scheme. |
29
|
|
|
* @param string|null $userinfo The user information. |
30
|
|
|
* @param string|null $host The host. |
31
|
|
|
* @param string|null $port The port. |
32
|
|
|
* @param string|null $path The path. |
33
|
|
|
* @param string|null $query The query component. |
34
|
|
|
* @param string|null $fragment The fragment identifier. |
35
|
|
|
* |
36
|
|
|
* @dataProvider decompositionProvider |
37
|
|
|
*/ |
38
|
|
|
public function testDecomposition($iri, $scheme, $userinfo, $host, $port, $path, $query, $fragment) |
39
|
|
|
{ |
40
|
|
|
$iri = new IRI($iri); |
41
|
|
|
$test = new IRI($iri); // test copy-constructor |
42
|
|
|
|
43
|
|
|
$this->assertEquals($scheme, $test->getScheme(), 'Scheme of ' . $iri); |
44
|
|
|
$this->assertEquals($userinfo, $test->getUserInfo(), 'User info of ' . $iri); |
45
|
|
|
$this->assertEquals($host, $test->getHost(), 'Host of ' . $iri); |
46
|
|
|
$this->assertEquals($port, $test->getPort(), 'Port of ' . $iri); |
47
|
|
|
$this->assertEquals($path, $test->getPath(), 'Path of ' . $iri); |
48
|
|
|
$this->assertEquals($query, $test->getQuery(), 'Query component of ' . $iri); |
49
|
|
|
$this->assertEquals($fragment, $test->getFragment(), 'Fragment of ' . $iri); |
50
|
|
|
$this->assertEquals($iri, $test->__toString(), 'Recomposition of ' . $iri); |
51
|
|
|
$this->assertTrue($test->equals($iri), 'Test equality of parsed ' . $iri); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Decomposition test cases |
56
|
|
|
* |
57
|
|
|
* These test cases were taken from the |
58
|
|
|
* {@link http://tools.ietf.org/html/rfc3986#section-1.1.2 URI specification} |
59
|
|
|
* and from {@link http://www.ninebynine.org/Software/HaskellUtils/Network/URITestDescriptions.html}. |
60
|
|
|
* |
61
|
|
|
* @return array The decomposition test cases. |
62
|
|
|
*/ |
63
|
|
|
public function decompositionProvider() |
64
|
|
|
{ |
65
|
|
|
return array( //$iri, $scheme, $userinfo, $host, $port, $path, $query, $fragment |
|
|
|
|
66
|
|
|
// http://tools.ietf.org/html/rfc3986#section-1.1.2 |
67
|
|
|
array('ftp://ftp.is.co.za/rfc/rfc1808.txt', 'ftp', null, 'ftp.is.co.za', null, '/rfc/rfc1808.txt', null, null), |
68
|
|
|
array('http://www.ietf.org/rfc/rfc2396.txt#frag', 'http', null, 'www.ietf.org', null, '/rfc/rfc2396.txt', null, 'frag'), |
69
|
|
|
array('ldap://[2001:db8::7]/c=GB?objectClass?one', 'ldap', null, '[2001:db8::7]', null, '/c=GB', 'objectClass?one', null), |
70
|
|
|
array('mailto:[email protected]', 'mailto', null, null, null, '[email protected]', null, null), |
71
|
|
|
array('news:comp.infosystems.www.servers.unix', 'news', null, null, null, 'comp.infosystems.www.servers.unix', null, null), |
72
|
|
|
array('tel:+1-816-555-1212', 'tel', null, null, null, '+1-816-555-1212', null, null), |
73
|
|
|
array('telnet://192.0.2.16:80/', 'telnet', null, '192.0.2.16', '80', '/', null, null), |
74
|
|
|
array('urn:oasis:names:specification:docbook:dtd:xml:4.1.2', 'urn', null, null, null, 'oasis:names:specification:docbook:dtd:xml:4.1.2', null, null), |
75
|
|
|
// http://www.ninebynine.org/Software/HaskellUtils/Network/URITestDescriptions.html |
76
|
|
|
array('http://user:[email protected]:99/aaa/bbb?qqq#fff', 'http', 'user:pass', 'example.org', '99', '/aaa/bbb' , 'qqq', 'fff'), |
77
|
|
|
// INVALID IRI array('http://user:[email protected]:99aaa/bbb'), |
|
|
|
|
78
|
|
|
array('http://user:[email protected]:99?aaa/bbb', 'http', 'user:pass', 'example.org', '99', '', 'aaa/bbb', null), |
79
|
|
|
array('http://user:[email protected]:99#aaa/bbb', 'http', 'user:pass', 'example.org', '99' , '', null, 'aaa/bbb'), |
80
|
|
|
array('http://example.com?query', 'http', null, 'example.com', null, '', 'query', null) |
81
|
|
|
); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Test whether parsing invalid values leads to an exception |
86
|
|
|
* |
87
|
|
|
* @expectedException InvalidArgumentException |
88
|
|
|
*/ |
89
|
|
|
public function testParseInvalidValue() |
90
|
|
|
{ |
91
|
|
|
new IRI(2); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Test whether an IRI is an absolute IRI or a relative one |
96
|
|
|
* |
97
|
|
|
* @param string $iri The IRI to test. |
98
|
|
|
* @param bool $isAbsolute True if the IRI is absolute, false otherwise. |
99
|
|
|
* |
100
|
|
|
* @dataProvider isAbsoluteProvider |
101
|
|
|
*/ |
102
|
|
|
public function testIsAbsolute($iri, $isAbsolute) |
103
|
|
|
{ |
104
|
|
|
$iri = new IRI($iri); |
105
|
|
|
$this->assertEquals($isAbsolute, $iri->isAbsolute()); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Absolute/relative IRI test cases |
111
|
|
|
* |
112
|
|
|
* These tests were taken from the |
113
|
|
|
* {@link http://tools.ietf.org/html/rfc3986#section-5.4 URI specification} and from |
114
|
|
|
* {@link http://www.ninebynine.org/Software/HaskellUtils/Network/URITestDescriptions.html}. |
115
|
|
|
* |
116
|
|
|
* @return array The absolute/relative IRI test cases. |
117
|
|
|
*/ |
118
|
|
|
public function isAbsoluteProvider() |
119
|
|
|
{ |
120
|
|
|
return array( |
121
|
|
|
// http://tools.ietf.org/html/rfc3986#section-5.4 |
122
|
|
|
array('http:g', true), |
123
|
|
|
array('g:h', true), |
124
|
|
|
array('g', false), |
125
|
|
|
array('./g', false), |
126
|
|
|
array('g/', false), |
127
|
|
|
array('/g', false), |
128
|
|
|
array('//g', false), |
129
|
|
|
array('?y', false), |
130
|
|
|
array('g?y', false), |
131
|
|
|
array('#s', false), |
132
|
|
|
array('g#s', false), |
133
|
|
|
array('g?y#s', false), |
134
|
|
|
array(';x', false), |
135
|
|
|
array('g;x', false), |
136
|
|
|
array('g;x?y#s', false), |
137
|
|
|
array('', false), |
138
|
|
|
array('.', false), |
139
|
|
|
array('./', false), |
140
|
|
|
array('..', false), |
141
|
|
|
array('../', false), |
142
|
|
|
array('../g', false), |
143
|
|
|
array('../..', false), |
144
|
|
|
array('../../', false), |
145
|
|
|
array('../../g', false), |
146
|
|
|
array('../../../g', false), |
147
|
|
|
array('../../../../g', false), |
148
|
|
|
array('/./g', false), |
149
|
|
|
array('/../g', false), |
150
|
|
|
array('g.', false), |
151
|
|
|
array('.g', false), |
152
|
|
|
array('g..', false), |
153
|
|
|
array('..g', false), |
154
|
|
|
array('./../g', false), |
155
|
|
|
array('./g/.', false), |
156
|
|
|
array('g/./h', false), |
157
|
|
|
array('g/../h', false), |
158
|
|
|
array('g;x=1/./y', false), |
159
|
|
|
array('g;x=1/../y', false), |
160
|
|
|
array('g?y/./x', false), |
161
|
|
|
array('g?y/../x', false), |
162
|
|
|
array('g#s/./x', false), |
163
|
|
|
array('g#s/../x', false), |
164
|
|
|
// http://www.ninebynine.org/Software/HaskellUtils/Network/URITestDescriptions.html |
165
|
|
|
array('http://example.org/aaa/bbb#ccc', true), |
166
|
|
|
array('mailto:[email protected]', true), |
167
|
|
|
array('mailto:[email protected]#frag', true), |
168
|
|
|
array('HTTP://EXAMPLE.ORG/AAA/BBB#CCC', true), |
169
|
|
|
array('http://example.org/aaa%2fbbb#ccc', true), |
170
|
|
|
array('http://example.org/aaa%2Fbbb#ccc', true), |
171
|
|
|
array('http://example.org:80/aaa/bbb#ccc', true), |
172
|
|
|
array('http://example.org:/aaa/bbb#ccc', true), |
173
|
|
|
array('http://example.org./aaa/bbb#ccc', true), |
174
|
|
|
array('http://example.123./aaa/bbb#ccc', true), |
175
|
|
|
array('http://example.org', true), |
176
|
|
|
array('http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html', true), |
177
|
|
|
array('http://[1080:0:0:0:8:800:200C:417A]/index.html', true), |
178
|
|
|
array('http://[3ffe:2a00:100:7031::1]', true), |
179
|
|
|
array('http://[1080::8:800:200C:417A]/foo', true), |
180
|
|
|
array('http://[::192.9.5.5]/ipng', true), |
181
|
|
|
array('http://[::FFFF:129.144.52.38]:80/index.html', true), |
182
|
|
|
array('http://[2010:836B:4179::836B:4179]', true), |
183
|
|
|
array('http://example/Andrȷ', true), |
184
|
|
|
array('file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/', true), |
185
|
|
|
array('http://46229EFFE16A9BD60B9F1BE88B2DB047ADDED785/demo.mp3', true), |
186
|
|
|
array('//example.org/aaa/bbb#ccc', false), |
187
|
|
|
array('/aaa/bbb#ccc', false), |
188
|
|
|
array('bbb#ccc', false), |
189
|
|
|
array('#ccc', false), |
190
|
|
|
array('#', false), |
191
|
|
|
array('/', false), |
192
|
|
|
array('%2F', false), |
193
|
|
|
array('aaa%2Fbbb', false), |
194
|
|
|
array('//[2010:836B:4179::836B:4179]', false), |
195
|
|
|
array("A'C", false), |
196
|
|
|
array('A$C', false), |
197
|
|
|
array('A@C', false), |
198
|
|
|
array('"A,C"', false) |
199
|
|
|
); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Test conversion to absolute IRI, i.e., removal of the fragment |
204
|
|
|
*/ |
205
|
|
|
public function testGetAbsoluteIri() |
206
|
|
|
{ |
207
|
|
|
$iri = new IRI('http://example.org/aaa%2fbbb#ccc'); |
208
|
|
|
$this->assertEquals('http://example.org/aaa%2fbbb', (string) $iri->getAbsoluteIri()); |
209
|
|
|
|
210
|
|
|
$iri = new IRI('http://example.org/iri#with-fragment/looking/like/a/path?and&query'); |
211
|
|
|
$this->assertEquals('http://example.org/iri', (string) $iri->getAbsoluteIri()); |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Test conversion to absolute IRI for a relative IRI |
216
|
|
|
* |
217
|
|
|
* @expectedException UnexpectedValueException |
218
|
|
|
*/ |
219
|
|
|
public function testGetAbsoluteIriOnRelativeIri() |
220
|
|
|
{ |
221
|
|
|
$iri = new IRI('/relative#with-fragment'); |
222
|
|
|
$iri->getAbsoluteIri(); |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* Test relative reference resolution |
227
|
|
|
* |
228
|
|
|
* @param string $base The base IRI. |
229
|
|
|
* @param string $reference The reference to resolve. |
230
|
|
|
* @param string $expected The expected absolute IRI. |
231
|
|
|
* |
232
|
|
|
* @dataProvider referenceResolutionProvider |
233
|
|
|
*/ |
234
|
|
|
public function testReferenceResolution($base, $reference, $expected) |
235
|
|
|
{ |
236
|
|
|
$base = new IRI($base); |
237
|
|
|
$this->assertEquals($expected, (string)$base->resolve($reference)); |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* Reference resolution test cases |
242
|
|
|
* |
243
|
|
|
* These test cases were taken from the |
244
|
|
|
* {@link http://tools.ietf.org/html/rfc3986#section-5.4 URI specification}, |
245
|
|
|
* from {@link http://www.w3.org/2004/04/uri-rel-test.html}, |
246
|
|
|
* {@link http://dig.csail.mit.edu/2005/ajar/ajaw/test/uri-test-doc.html}, |
247
|
|
|
* {@link http://www.ninebynine.org/Software/HaskellUtils/Network/URITestDescriptions.html}, |
248
|
|
|
* and {@link http://greenbytes.de/tech/tc/uris/}. |
249
|
|
|
* |
250
|
|
|
* @return array The reference resolution test cases. |
251
|
|
|
*/ |
252
|
|
|
public function referenceResolutionProvider() |
253
|
|
|
{ |
254
|
|
|
return array( // $base, $relative, $absolute |
|
|
|
|
255
|
|
|
array('', '../a/b', '/a/b'), |
256
|
|
|
array('', '/.', '/'), |
257
|
|
|
array(null, '', ''), |
258
|
|
|
array('', null, ''), |
259
|
|
|
array(null, null, ''), |
260
|
|
|
// http://tools.ietf.org/html/rfc3986#section-5.4 |
261
|
|
|
array('http://a/b/c/d;p?q', 'g:h', 'g:h'), |
262
|
|
|
array('http://a/b/c/d;p?q', 'g', 'http://a/b/c/g'), |
263
|
|
|
array('http://a/b/c/d;p?q', './g', 'http://a/b/c/g'), |
264
|
|
|
array('http://a/b/c/d;p?q', 'g/', 'http://a/b/c/g/'), |
265
|
|
|
array('http://a/b/c/d;p?q', '/g', 'http://a/g'), |
266
|
|
|
array('http://a/b/c/d;p?q', '//g', 'http://g'), |
267
|
|
|
array('http://a/b/c/d;p?q', '?y', 'http://a/b/c/d;p?y'), |
268
|
|
|
array('http://a/b/c/d;p?q', 'g?y', 'http://a/b/c/g?y'), |
269
|
|
|
array('http://a/b/c/d;p?q', '#s', 'http://a/b/c/d;p?q#s'), |
270
|
|
|
array('http://a/b/c/d;p?q', 'g#s', 'http://a/b/c/g#s'), |
271
|
|
|
array('http://a/b/c/d;p?q', 'g?y#s', 'http://a/b/c/g?y#s'), |
272
|
|
|
array('http://a/b/c/d;p?q', ';x', 'http://a/b/c/;x'), |
273
|
|
|
array('http://a/b/c/d;p?q', 'g;x', 'http://a/b/c/g;x'), |
274
|
|
|
array('http://a/b/c/d;p?q', 'g;x?y#s', 'http://a/b/c/g;x?y#s'), |
275
|
|
|
array('http://a/b/c/d;p?q', '', 'http://a/b/c/d;p?q'), |
276
|
|
|
array('http://a/b/c/d;p?q', '.', 'http://a/b/c/'), |
277
|
|
|
array('http://a/b/c/d;p?q', './', 'http://a/b/c/'), |
278
|
|
|
array('http://a/b/c/d;p?q', '..', 'http://a/b/'), |
279
|
|
|
array('http://a/b/c/d;p?q', '../', 'http://a/b/'), |
280
|
|
|
array('http://a/b/c/d;p?q', '../g', 'http://a/b/g'), |
281
|
|
|
array('http://a/b/c/d;p?q', '../..', 'http://a/'), |
282
|
|
|
array('http://a/b/c/d;p?q', '../../', 'http://a/'), |
283
|
|
|
array('http://a/b/c/d;p?q', '../../g', 'http://a/g'), |
284
|
|
|
array('http://a/b/c/d;p?q', '../../../g', 'http://a/g'), |
285
|
|
|
array('http://a/b/c/d;p?q', '../../../../g', 'http://a/g'), |
286
|
|
|
array('http://a/b/c/d;p?q', '/./g', 'http://a/g'), |
287
|
|
|
array('http://a/b/c/d;p?q', '/../g', 'http://a/g'), |
288
|
|
|
array('http://a/b/c/d;p?q', 'g.', 'http://a/b/c/g.'), |
289
|
|
|
array('http://a/b/c/d;p?q', '.g', 'http://a/b/c/.g'), |
290
|
|
|
array('http://a/b/c/d;p?q', 'g..', 'http://a/b/c/g..'), |
291
|
|
|
array('http://a/b/c/d;p?q', '..g', 'http://a/b/c/..g'), |
292
|
|
|
array('http://a/b/c/d;p?q', './../g', 'http://a/b/g'), |
293
|
|
|
array('http://a/b/c/d;p?q', './g/.', 'http://a/b/c/g/'), |
294
|
|
|
array('http://a/b/c/d;p?q', 'g/./h', 'http://a/b/c/g/h'), |
295
|
|
|
array('http://a/b/c/d;p?q', 'g/../h', 'http://a/b/c/h'), |
296
|
|
|
array('http://a/b/c/d;p?q', 'g;x=1/./y', 'http://a/b/c/g;x=1/y'), |
297
|
|
|
array('http://a/b/c/d;p?q', 'g;x=1/../y', 'http://a/b/c/y'), |
298
|
|
|
array('http://a/b/c/d;p?q', 'g?y/./x', 'http://a/b/c/g?y/./x'), |
299
|
|
|
array('http://a/b/c/d;p?q', 'g?y/../x', 'http://a/b/c/g?y/../x'), |
300
|
|
|
array('http://a/b/c/d;p?q', 'g#s/./x', 'http://a/b/c/g#s/./x'), |
301
|
|
|
array('http://a/b/c/d;p?q', 'g#s/../x', 'http://a/b/c/g#s/../x'), |
302
|
|
|
array('http://a/b/c/d;p?q', 'http:g', 'http:g'), |
303
|
|
|
// http://www.w3.org/2004/04/uri-rel-test.html |
304
|
|
|
array('http://a/b/c/d;p?q', './g:h', 'http://a/b/c/g:h'), |
305
|
|
|
// http://dig.csail.mit.edu/2005/ajar/ajaw/test/uri-test-doc.html |
306
|
|
|
// http://www.ninebynine.org/Software/HaskellUtils/Network/URITestDescriptions.html |
307
|
|
|
array('foo:xyz', 'bar:abc', 'bar:abc'), |
308
|
|
|
array('http://example/x/y/z', '../abc', 'http://example/x/abc'), |
309
|
|
|
array('http://example2/x/y/z', '//example/x/abc', 'http://example/x/abc'), |
310
|
|
|
array('http://example2/x/y/z', 'http://example/x/abc', 'http://example/x/abc'), |
311
|
|
|
array('http://ex/x/y/z', '../r', 'http://ex/x/r'), |
312
|
|
|
array('http://ex/x/y/z', '/r', 'http://ex/r'), |
313
|
|
|
array('http://ex/x/y/z', 'q/r', 'http://ex/x/y/q/r'), |
314
|
|
|
array('http://ex/x/y', 'q/r#s', 'http://ex/x/q/r#s'), |
315
|
|
|
array('http://ex/x/y', 'q/r#s/t', 'http://ex/x/q/r#s/t'), |
316
|
|
|
array('http://ex/x/y', 'ftp://ex/x/q/r', 'ftp://ex/x/q/r'), |
317
|
|
|
array('http://ex/x/y', '', 'http://ex/x/y'), |
318
|
|
|
array('http://ex/x/y/', '', 'http://ex/x/y/'), |
319
|
|
|
array('http://ex/x/y/pdq', '', 'http://ex/x/y/pdq'), |
320
|
|
|
array('http://ex/x/y/', 'z/', 'http://ex/x/y/z/'), |
321
|
|
|
array('file:/swap/test/animal.rdf', '#Animal', 'file:/swap/test/animal.rdf#Animal'), |
322
|
|
|
array('file:/e/x/y/z', '../abc', 'file:/e/x/abc'), |
323
|
|
|
array('file:/example2/x/y/z', '/example/x/abc', 'file:/example/x/abc'), |
324
|
|
|
array('file:/ex/x/y/z', '../r', 'file:/ex/x/r'), |
325
|
|
|
array('file:/ex/x/y/z', '/r', 'file:/r'), |
326
|
|
|
array('file:/ex/x/y', 'q/r', 'file:/ex/x/q/r'), |
327
|
|
|
array('file:/ex/x/y', 'q/r#s', 'file:/ex/x/q/r#s'), |
328
|
|
|
array('file:/ex/x/y', 'q/r#', 'file:/ex/x/q/r#'), |
329
|
|
|
array('file:/ex/x/y', 'q/r#s/t', 'file:/ex/x/q/r#s/t'), |
330
|
|
|
array('file:/ex/x/y', 'ftp://ex/x/q/r', 'ftp://ex/x/q/r'), |
331
|
|
|
array('file:/ex/x/y', '', 'file:/ex/x/y'), |
332
|
|
|
array('file:/ex/x/y/', '', 'file:/ex/x/y/'), |
333
|
|
|
array('file:/ex/x/y/pdq', '', 'file:/ex/x/y/pdq'), |
334
|
|
|
array('file:/ex/x/y/', 'z/', 'file:/ex/x/y/z/'), |
335
|
|
|
array('file:/devel/WWW/2000/10/swap/test/reluri-1.n3', '//meetings.example.com/cal#m1', 'file://meetings.example.com/cal#m1'), |
336
|
|
|
array('file:/home/connolly/w3ccvs/WWW/2000/10/swap/test/reluri-1.n3', '//meetings.example.com/cal#m1', 'file://meetings.example.com/cal#m1'), |
337
|
|
|
array('file:/some/dir/foo', './#blort', 'file:/some/dir/#blort'), |
338
|
|
|
array('file:/some/dir/foo', './#', 'file:/some/dir/#'), |
339
|
|
|
array('http://ex/x/y', './q:r', 'http://ex/x/q:r'), |
340
|
|
|
array('http://ex/x/y', './p=q:r', 'http://ex/x/p=q:r'), |
341
|
|
|
array('http://ex/x/y?pp/qq', '?pp/rr', 'http://ex/x/y?pp/rr'), |
342
|
|
|
array('http://ex/x/y?pp/qq', 'y/z', 'http://ex/x/y/z'), |
343
|
|
|
array('mailto:local', 'local/[email protected]#frag', 'mailto:local/[email protected]#frag'), |
344
|
|
|
array('mailto:local/[email protected]', 'more/[email protected]#frag', 'mailto:local/more/[email protected]#frag'), |
345
|
|
|
array('http://ex/x/z?q', 'y?q', 'http://ex/x/y?q'), |
346
|
|
|
array('http://ex?p', '/x/y?q', 'http://ex/x/y?q'), |
347
|
|
|
array('foo:a/b', 'c/d', 'foo:a/c/d'), |
348
|
|
|
array('foo:a/b', '/c/d', 'foo:/c/d'), |
349
|
|
|
array('foo:a/b?c#d', '', 'foo:a/b?c'), |
350
|
|
|
array('foo:a', 'b/c', 'foo:b/c'), |
351
|
|
|
array('foo:/a/y/z', '../b/c', 'foo:/a/b/c'), |
352
|
|
|
array('foo:a', '/./b/c', 'foo:/b/c'), |
353
|
|
|
array('foo://a//b/c', '../../d', 'foo://a/d'), |
354
|
|
|
array('foo:a', '.', 'foo:'), |
355
|
|
|
array('foo:a', '..', 'foo:'), |
356
|
|
|
array('http://example/x/y%2Fz', 'abc', 'http://example/x/abc'), |
357
|
|
|
array('http://example/a/x/y/z', '../../x%2Fabc', 'http://example/a/x%2Fabc'), |
358
|
|
|
array('http://example/a/x/y%2Fz', '../x%2Fabc', 'http://example/a/x%2Fabc'), |
359
|
|
|
array('http://example/x%2Fy/z', 'abc', 'http://example/x%2Fy/abc'), |
360
|
|
|
array('http://ex/x/y', 'q%3Ar', 'http://ex/x/q%3Ar'), |
361
|
|
|
array('http://example/x/y%2Fz', '/x%2Fabc', 'http://example/x%2Fabc'), |
362
|
|
|
array('http://example/x/y/z', '/x%2Fabc', 'http://example/x%2Fabc'), |
363
|
|
|
array('http://example/x/y%2Fz', '/x%2Fabc', 'http://example/x%2Fabc'), |
364
|
|
|
array('ftp://example/x/y', 'http://example/a/b/../../c', 'http://example/c'), |
365
|
|
|
array('ftp://example/x/y', 'http://example/a/b/c/../../', 'http://example/a/'), |
366
|
|
|
array('ftp://example/x/y', 'http://example/a/b/c/./', 'http://example/a/b/c/'), |
367
|
|
|
array('ftp://example/x/y', 'http://example/a/b/c/.././', 'http://example/a/b/'), |
368
|
|
|
array('ftp://example/x/y', 'http://example/a/b/c/d/../../../../e', 'http://example/e'), |
369
|
|
|
array('ftp://example/x/y', 'http://example/a/b/c/d/../.././../../e', 'http://example/e'), |
370
|
|
|
array('mailto:local1@domain1?query1', 'local2@domain2', 'mailto:local2@domain2'), |
371
|
|
|
array('mailto:local1@domain1', 'local2@domain2?query2', 'mailto:local2@domain2?query2'), |
372
|
|
|
array('mailto:local1@domain1?query1', 'local2@domain2?query2', 'mailto:local2@domain2?query2'), |
373
|
|
|
array('mailto:local@domain?query1', '?query2', 'mailto:local@domain?query2'), |
374
|
|
|
array('mailto:?query1', 'local@domain?query2', 'mailto:local@domain?query2'), |
375
|
|
|
array('mailto:local@domain?query1', '?query2', 'mailto:local@domain?query2'), |
376
|
|
|
array('foo:bar', 'http://example/a/b?c/../d', 'http://example/a/b?c/../d'), |
377
|
|
|
array('foo:bar', 'http://example/a/b#c/../d', 'http://example/a/b#c/../d'), |
378
|
|
|
array('http://example.org/base/uri', 'this', 'http://example.org/base/this'), // Fixed absolute from http:this |
379
|
|
|
array('http://example.org/base/uri', 'http:this', 'http:this'), |
380
|
|
|
array('http:base', 'http:this', 'http:this'), |
381
|
|
|
array('f:/a', './/g', 'f://g'), |
382
|
|
|
array('f://example.org/base/a', 'b/c//d/e', 'f://example.org/base/b/c//d/e'), |
383
|
|
|
array('mid:[email protected]/[email protected]', '[email protected]/[email protected]', 'mid:[email protected]/[email protected]/[email protected]'), |
384
|
|
|
array('file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/', 'mini1.xml', 'file:///C:/DEV/Haskell/lib/HXmlToolbox-3.01/examples/mini1.xml'), |
385
|
|
|
array('foo:a/y/z', '../b/c', 'foo:a/b/c'), |
386
|
|
|
array('http://ex', '/x/y?q', 'http://ex/x/y?q'), |
387
|
|
|
array('http://ex', 'x/y?q', 'http://ex/x/y?q'), |
388
|
|
|
array('http://ex?p', '/x/y?q', 'http://ex/x/y?q'), |
389
|
|
|
array('http://ex?p', 'x/y?q', 'http://ex/x/y?q'), |
390
|
|
|
array('http://ex#f', '/x/y?q', 'http://ex/x/y?q'), |
391
|
|
|
array('http://ex#f', 'x/y?q', 'http://ex/x/y?q'), |
392
|
|
|
array('http://ex?p', '/x/y#g', 'http://ex/x/y#g'), |
393
|
|
|
array('http://ex?p', 'x/y#g', 'http://ex/x/y#g'), |
394
|
|
|
array('http://ex', '/', 'http://ex/'), |
395
|
|
|
array('http://ex', './', 'http://ex/'), |
396
|
|
|
array('http://ex', '/a/b', 'http://ex/a/b'), |
397
|
|
|
array('http://ex/a/b', './', 'http://ex/a/'), |
398
|
|
|
array('mailto:local/[email protected]?notaquery#frag', 'more@domain', 'mailto:local/more@domain'), |
399
|
|
|
array('mailto:local/[email protected]?notaquery#frag', '#newfrag', 'mailto:local/[email protected]?notaquery#newfrag'), |
400
|
|
|
array('mailto:local/[email protected]?notaquery#frag', 'l1/q1@domain', 'mailto:local/l1/q1@domain'), |
401
|
|
|
array('mailto:local1@domain1?query1', 'mailto:local2@domain2', 'mailto:local2@domain2'), |
402
|
|
|
array('mailto:local1@domain1', 'mailto:local2@domain2?query2', 'mailto:local2@domain2?query2'), |
403
|
|
|
array('mailto:local1@domain1?query1', 'mailto:local2@domain2?query2', 'mailto:local2@domain2?query2'), |
404
|
|
|
array('mailto:local@domain?query1', 'mailto:local@domain?query2', 'mailto:local@domain?query2'), |
405
|
|
|
array('mailto:?query1', 'mailto:local@domain?query2', 'mailto:local@domain?query2'), |
406
|
|
|
array('mailto:local@domain?query1', '?query2', 'mailto:local@domain?query2'), |
407
|
|
|
array('info:name/1234/../567', 'name/9876/../543', 'info:name/name/543'), |
408
|
|
|
array('info:/name/1234/../567', 'name/9876/../543', 'info:/name/name/543'), |
409
|
|
|
array('http://ex/x/y', 'q/r', 'http://ex/x/q/r'), |
410
|
|
|
array('file:/devel/WWW/2000/10/swap/test/reluri-1.n3', 'file://meetings.example.com/cal#m1', 'file://meetings.example.com/cal#m1'), |
411
|
|
|
array('file:/home/connolly/w3ccvs/WWW/2000/10/swap/test/reluri-1.n3', 'file://meetings.example.com/cal#m1', 'file://meetings.example.com/cal#m1'), |
412
|
|
|
array('http://example/x/abc.efg', './', 'http://example/x/'), |
413
|
|
|
array('http://www.w3.org/People/Berners-Lee/card.rdf', '../../2002/01/tr-automation/tr.rdf', 'http://www.w3.org/2002/01/tr-automation/tr.rdf'), |
414
|
|
|
array('http://example.com/', '.', 'http://example.com/'), |
415
|
|
|
array('http://example.com/.meta.n3', '.meta.n3', 'http://example.com/.meta.n3'), |
416
|
|
|
// http://greenbytes.de/tech/tc/uris/ |
417
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'http://a/b/c/d;p?q', 'http://a/b/c/d;p?q'), |
418
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g:h', 'g:h'), |
419
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '', 'data:text/plain;charset=iso-8859-7,%be%fg%be'), |
420
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g', 'data:text/g'), |
421
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', './g', 'data:text/g'), |
422
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g/', 'data:text/g/'), |
423
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '/g', 'data:/g'), |
424
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '//g', 'data://g'), |
425
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '?y', 'data:text/plain;charset=iso-8859-7,%be%fg%be?y'), |
426
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g?y', 'data:text/g?y'), |
427
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '#s', 'data:text/plain;charset=iso-8859-7,%be%fg%be#s'), |
428
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g#s', 'data:text/g#s'), |
429
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g?y#s', 'data:text/g?y#s'), |
430
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', ';x', 'data:text/;x'), |
431
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g;x', 'data:text/g;x'), |
432
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g;x?y#s', 'data:text/g;x?y#s'), |
433
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '', 'data:text/plain;charset=iso-8859-7,%be%fg%be'), |
434
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '.', 'data:text/'), |
435
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', './', 'data:text/'), |
436
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '..', 'data:/'), |
437
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '../', 'data:/'), |
438
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '../g', 'data:/g'), |
439
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '../..', 'data:/'), |
440
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '../../', 'data:/'), |
441
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '../../g', 'data:/g'), |
442
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '../../../g', 'data:/g'), |
443
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '../../../../g', 'data:/g'), |
444
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '/./g', 'data:/g'), |
445
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '/../g', 'data:/g'), |
446
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g.', 'data:text/g.'), |
447
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '.g', 'data:text/.g'), |
448
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'g..', 'data:text/g..'), |
449
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', '..g', 'data:text/..g'), |
450
|
|
|
array('http://a/b/c/d;p?q', 'data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7', 'data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7'), |
451
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7', 'data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7'), |
452
|
|
|
array('http://a/b/c/d;p?q', 'data:text/plain;charset=iso-8859-7,%be%fg%be', 'data:text/plain;charset=iso-8859-7,%be%fg%be'), |
453
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'data:text/plain;charset=iso-8859-7,%be%fg%be', 'data:text/plain;charset=iso-8859-7,%be%fg%be'), |
454
|
|
|
array('http://a/b/c/d;p?q', 'http://www.example.org/Dürst', 'http://www.example.org/Dürst'), |
455
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'http://www.example.org/Dürst', 'http://www.example.org/Dürst'), |
456
|
|
|
array('http://a/b/c/d;p?q', 'http://www.example.org/foo bar/qux<>?\^`{|}', 'http://www.example.org/foo bar/qux<>?\^`{|}'), |
457
|
|
|
array('data:text/plain;charset=iso-8859-7,%be%fg%be', 'http://www.example.org/foo bar/qux<>?\^`{|}', 'http://www.example.org/foo bar/qux<>?\^`{|}'), |
458
|
|
|
array('http://example.com/b;bar', ';foo', 'http://example.com/;foo'), |
459
|
|
|
array('http://1.example.org/path1/file1.ext', 'http://2.example.org#frag2', 'http://2.example.org#frag2'), |
460
|
|
|
array('http://example.org/a/b', '?x', 'http://example.org/a/b?x'), |
461
|
|
|
array('http://example.org/foo/bar', 'http:test', 'http:test'), |
462
|
|
|
array('http://www.example.com/#', 'hello, world', 'http://www.example.com/hello, world'), |
463
|
|
|
array('http://www.example.com/#', '%c2%a9', 'http://www.example.com/%c2%a9'), |
464
|
|
|
array('http://www.example.com/#', '%41%a', 'http://www.example.com/%41%a'), |
465
|
|
|
array('http://www.example.com/#', 'asdf#qwer', 'http://www.example.com/asdf#qwer'), |
466
|
|
|
array('http://www.example.com/#', '#asdf', 'http://www.example.com/#asdf'), |
467
|
|
|
array('http://www.example.com/foo/bar', 'file:c:\\\\foo\\\\bar.html', 'file:c:\\\\foo\\\\bar.html'), |
468
|
|
|
array('http://www.example.com/foo/bar', 'File:c|////foo\\\\bar.html', 'File:c|////foo\\\\bar.html'), |
469
|
|
|
array('http://www.example.com/foo/bar', 'file:', 'file:'), |
470
|
|
|
array('http://www.example.com/foo/bar', 'file:UNChost/path', 'file:UNChost/path'), |
471
|
|
|
array('http://www.example.com/foo/bar', 'c:\\\\foo\\\\bar', 'c:\\\\foo\\\\bar'), |
472
|
|
|
array('http://www.example.com/foo/bar', 'C|/foo/bar', 'http://www.example.com/foo/C|/foo/bar'), |
473
|
|
|
array('http://www.example.com/foo/bar', '/C|\\\\foo\\\\bar', 'http://www.example.com/C|\\\\foo\\\\bar'), |
474
|
|
|
array('http://www.example.com/foo/bar', '//C|/foo/bar', 'http://C|/foo/bar'), |
475
|
|
|
array('http://www.example.com/foo/bar', '//server/file', 'http://server/file'), |
476
|
|
|
array('http://www.example.com/foo/bar', '\\\\\\\\server\\\\file', 'http://www.example.com/foo/\\\\\\\\server\\\\file'), |
477
|
|
|
array('http://www.example.com/foo/bar', '/\\\\server/file', 'http://www.example.com/\\\\server/file'), |
478
|
|
|
array('http://www.example.com/foo/bar', 'file:c:foo/bar.html', 'file:c:foo/bar.html'), |
479
|
|
|
array('http://www.example.com/foo/bar', 'file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html', 'file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html'), |
480
|
|
|
array('http://www.example.com/foo/bar', 'file:///foo/bar.txt', 'file:///foo/bar.txt'), |
481
|
|
|
array('http://www.example.com/foo/bar', 'FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html', 'FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html'), |
482
|
|
|
array('http://www.example.com/foo/bar', 'file:filer/home\\\\me', 'file:filer/home\\\\me'), |
483
|
|
|
array('http://www.example.com/foo/bar', 'file:///C:/foo/../../../bar.html', 'file:///bar.html'), |
484
|
|
|
array('http://www.example.com/foo/bar', 'file:///C:/asdf#\\%c2', 'file:///C:/asdf#\\%c2'), |
485
|
|
|
array('http://www.example.com/foo/bar', 'file:///home/me', 'file:///home/me'), |
486
|
|
|
array('http://www.example.com/foo/bar', 'file:c:\\\\foo\\\\bar.html', 'file:c:\\\\foo\\\\bar.html'), |
487
|
|
|
array('http://www.example.com/foo/bar', 'file:c|//foo\\\\bar.html', 'file:c|//foo\\\\bar.html'), |
488
|
|
|
array('http://www.example.com/foo/bar', '//', 'http://'), |
489
|
|
|
array('http://www.example.com/foo/bar', '///', 'http:///'), |
490
|
|
|
array('http://www.example.com/foo/bar', '///test', 'http:///test'), |
491
|
|
|
array('http://www.example.com/foo/bar', 'file://test', 'file://test'), |
492
|
|
|
array('http://www.example.com/foo/bar', 'file://localhost/', 'file://localhost/'), |
493
|
|
|
array('http://www.example.com/foo/bar', 'file://localhost/test', 'file://localhost/test'), |
494
|
|
|
array('file:///tmp/mock/path', 'file:c:\\\\foo\\\\bar.html', 'file:c:\\\\foo\\\\bar.html'), |
495
|
|
|
array('file:///tmp/mock/path', 'File:c|////foo\\\\bar.html', 'File:c|////foo\\\\bar.html'), |
496
|
|
|
array('file:///tmp/mock/path', 'file:', 'file:'), |
497
|
|
|
array('file:///tmp/mock/path', 'file:UNChost/path', 'file:UNChost/path'), |
498
|
|
|
array('file:///tmp/mock/path', 'c:\\\\foo\\\\bar', 'c:\\\\foo\\\\bar'), |
499
|
|
|
array('file:///tmp/mock/path', 'C|/foo/bar', 'file:///tmp/mock/C|/foo/bar'), |
500
|
|
|
array('file:///tmp/mock/path', '/C|\\\\foo\\\\bar', 'file:///C|\\\\foo\\\\bar'), |
501
|
|
|
array('file:///tmp/mock/path', '//C|/foo/bar', 'file://C|/foo/bar'), |
502
|
|
|
array('file:///tmp/mock/path', '//server/file', 'file://server/file'), |
503
|
|
|
array('file:///tmp/mock/path', '\\\\\\\\server\\\\file', 'file:///tmp/mock/\\\\\\\\server\\\\file'), |
504
|
|
|
array('file:///tmp/mock/path', '/\\\\server/file', 'file:///\\\\server/file'), |
505
|
|
|
array('file:///tmp/mock/path', 'file:c:foo/bar.html', 'file:c:foo/bar.html'), |
506
|
|
|
array('file:///tmp/mock/path', 'file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html', 'file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html'), |
507
|
|
|
array('file:///tmp/mock/path', 'file:///foo/bar.txt', 'file:///foo/bar.txt'), |
508
|
|
|
array('file:///tmp/mock/path', 'FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html', 'FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html'), |
509
|
|
|
array('file:///tmp/mock/path', 'file:filer/home\\\\me', 'file:filer/home\\\\me'), |
510
|
|
|
array('file:///tmp/mock/path', 'file:///C:/foo/../../../bar.html', 'file:///bar.html'), |
511
|
|
|
array('file:///tmp/mock/path', 'file:///C:/asdf#\\%c2', 'file:///C:/asdf#\\%c2'), |
512
|
|
|
array('file:///tmp/mock/path', 'file:///home/me', 'file:///home/me'), |
513
|
|
|
array('file:///tmp/mock/path', 'file:c:\\\\foo\\\\bar.html', 'file:c:\\\\foo\\\\bar.html'), |
514
|
|
|
array('file:///tmp/mock/path', 'file:c|//foo\\\\bar.html', 'file:c|//foo\\\\bar.html'), |
515
|
|
|
array('file:///tmp/mock/path', '//', 'file://'), |
516
|
|
|
array('file:///tmp/mock/path', '///', 'file:///'), |
517
|
|
|
array('file:///tmp/mock/path', '///test', 'file:///test'), |
518
|
|
|
array('file:///tmp/mock/path', 'file://test', 'file://test'), |
519
|
|
|
array('file:///tmp/mock/path', 'file://localhost/', 'file://localhost/'), |
520
|
|
|
array('file:///tmp/mock/path', 'file://localhost/test', 'file://localhost/test'), |
521
|
|
|
array('http://', 'GoOgLe.CoM', 'http:///GoOgLe.CoM'), |
522
|
|
|
array('http://', 'Goo%20 goo%7C|.com', 'http:///Goo%20 goo%7C|.com'), |
523
|
|
|
array('http://', '%ef%b7%90zyx.com', 'http:///%ef%b7%90zyx.com'), |
524
|
|
|
array('http://', '%ef%bc%85%ef%bc%94%ef%bc%91.com', 'http:///%ef%bc%85%ef%bc%94%ef%bc%91.com'), |
525
|
|
|
array('http://', '%ef%bc%85%ef%bc%90%ef%bc%90.com', 'http:///%ef%bc%85%ef%bc%90%ef%bc%90.com'), |
526
|
|
|
array('http://', '%zz%66%a', 'http:///%zz%66%a'), |
527
|
|
|
array('http://', '%25', 'http:///%25'), |
528
|
|
|
array('http://', 'hello%00', 'http:///hello%00'), |
529
|
|
|
array('http://', '%30%78%63%30%2e%30%32%35%30.01', 'http:///%30%78%63%30%2e%30%32%35%30.01'), |
530
|
|
|
array('http://', '%30%78%63%30%2e%30%32%35%30.01%2e', 'http:///%30%78%63%30%2e%30%32%35%30.01%2e'), |
531
|
|
|
array('http://', '%3g%78%63%30%2e%30%32%35%30%2E.01', 'http:///%3g%78%63%30%2e%30%32%35%30%2E.01'), |
532
|
|
|
array('http://', '192.168.0.1 hello', 'http:///192.168.0.1 hello'), |
533
|
|
|
array('http://', '192.168.0.257', 'http:///192.168.0.257'), |
534
|
|
|
array('http://', '[google.com]', 'http:///[google.com]'), |
535
|
|
|
array('http://', 'go\\@ogle.com', 'http:///go\\@ogle.com'), |
536
|
|
|
array('http://', 'go/@ogle.com', 'http:///go/@ogle.com'), |
537
|
|
|
array('http://', 'www.lookout.net::==80::==443::', 'www.lookout.net::==80::==443::'), |
538
|
|
|
array('http://', 'www.lookout.net::80::443', 'www.lookout.net::80::443'), |
539
|
|
|
array('http://', '\\\\', 'http:///\\\\'), |
540
|
|
|
array('http://', '\\\\\\/', 'http:///\\\\\\/'), |
541
|
|
|
array('http://', '\\\\./', 'http:///\\\\./'), |
542
|
|
|
array('http://', '//:@/', 'http://:@/'), |
543
|
|
|
array('http://', '\\google.com/foo', 'http:///\\google.com/foo'), |
544
|
|
|
array('http://', '\\\\google.com/foo', 'http:///\\\\google.com/foo'), |
545
|
|
|
array('http://', '//asdf@/', 'http://asdf@/'), |
546
|
|
|
array('http://', '//:81', 'http://:81'), |
547
|
|
|
array('http://', '://', 'http:///://'), |
548
|
|
|
array('http://', 'c:', 'c:'), |
549
|
|
|
array('http://', 'xxxx:', 'xxxx:'), |
550
|
|
|
array('http://', '.:.', '.:'), |
551
|
|
|
array('http://', '////@google.com/', 'http:////@google.com/'), |
552
|
|
|
array('http://', '@google.com', 'http:///@google.com'), |
553
|
|
|
array('http://', 'gOoGle.com', 'http:///gOoGle.com'), |
554
|
|
|
array('http://', '-foo.bar.com', 'http:///-foo.bar.com'), |
555
|
|
|
array('http://', 'foo-.bar.com', 'http:///foo-.bar.com'), |
556
|
|
|
array('http://', 'ab--cd.com', 'http:///ab--cd.com'), |
557
|
|
|
array('http://', 'xn--0.com', 'http:///xn--0.com'), |
558
|
|
|
array('http://', '.', 'http:///'), |
559
|
|
|
array('http://', '192.168.0.1', 'http:///192.168.0.1'), |
560
|
|
|
array('http://', '0300.0250.00.01', 'http:///0300.0250.00.01'), |
561
|
|
|
array('http://', '0xC0.0Xa8.0x0.0x1', 'http:///0xC0.0Xa8.0x0.0x1'), |
562
|
|
|
array('http://', '192.168.9.com', 'http:///192.168.9.com'), |
563
|
|
|
array('http://', '19a.168.0.1', 'http:///19a.168.0.1'), |
564
|
|
|
array('http://', '0308.0250.00.01', 'http:///0308.0250.00.01'), |
565
|
|
|
array('http://', '0xCG.0xA8.0x0.0x1', 'http:///0xCG.0xA8.0x0.0x1'), |
566
|
|
|
array('http://', '192', 'http:///192'), |
567
|
|
|
array('http://', '0xC0a80001', 'http:///0xC0a80001'), |
568
|
|
|
array('http://', '030052000001', 'http:///030052000001'), |
569
|
|
|
array('http://', '000030052000001', 'http:///000030052000001'), |
570
|
|
|
array('http://', '192.168', 'http:///192.168'), |
571
|
|
|
array('http://', '192.0x00A80001', 'http:///192.0x00A80001'), |
572
|
|
|
array('http://', '0xc0.052000001', 'http:///0xc0.052000001'), |
573
|
|
|
array('http://', '192.168.1', 'http:///192.168.1'), |
574
|
|
|
array('http://', '192.168.0.0.1', 'http:///192.168.0.0.1'), |
575
|
|
|
array('http://', '192.168.0.1.', 'http:///192.168.0.1.'), |
576
|
|
|
array('http://', '192.168.0.1. hello', 'http:///192.168.0.1. hello'), |
577
|
|
|
array('http://', '192.168.0.1..', 'http:///192.168.0.1..'), |
578
|
|
|
array('http://', '192.168..1', 'http:///192.168..1'), |
579
|
|
|
array('http://', '0x100.0', 'http:///0x100.0'), |
580
|
|
|
array('http://', '0x100.0.0', 'http:///0x100.0.0'), |
581
|
|
|
array('http://', '0x100.0.0.0', 'http:///0x100.0.0.0'), |
582
|
|
|
array('http://', '0.0x100.0.0', 'http:///0.0x100.0.0'), |
583
|
|
|
array('http://', '0.0.0x100.0', 'http:///0.0.0x100.0'), |
584
|
|
|
array('http://', '0.0.0.0x100', 'http:///0.0.0.0x100'), |
585
|
|
|
array('http://', '0.0.0x10000', 'http:///0.0.0x10000'), |
586
|
|
|
array('http://', '0.0x1000000', 'http:///0.0x1000000'), |
587
|
|
|
array('http://', '0x100000000', 'http:///0x100000000'), |
588
|
|
|
array('http://', '0xFF.0', 'http:///0xFF.0'), |
589
|
|
|
array('http://', '0xFF.0.0', 'http:///0xFF.0.0'), |
590
|
|
|
array('http://', '0xFF.0.0.0', 'http:///0xFF.0.0.0'), |
591
|
|
|
array('http://', '0.0xFF.0.0', 'http:///0.0xFF.0.0'), |
592
|
|
|
array('http://', '0.0.0xFF.0', 'http:///0.0.0xFF.0'), |
593
|
|
|
array('http://', '0.0.0.0xFF', 'http:///0.0.0.0xFF'), |
594
|
|
|
array('http://', '0.0.0xFFFF', 'http:///0.0.0xFFFF'), |
595
|
|
|
array('http://', '0.0xFFFFFF', 'http:///0.0xFFFFFF'), |
596
|
|
|
array('http://', '0xFFFFFFFF', 'http:///0xFFFFFFFF'), |
597
|
|
|
array('http://', '276.256.0xf1a2.077777', 'http:///276.256.0xf1a2.077777'), |
598
|
|
|
array('http://', '192.168.0.257', 'http:///192.168.0.257'), |
599
|
|
|
array('http://', '192.168.0xa20001', 'http:///192.168.0xa20001'), |
600
|
|
|
array('http://', '192.015052000001', 'http:///192.015052000001'), |
601
|
|
|
array('http://', '0X12C0a80001', 'http:///0X12C0a80001'), |
602
|
|
|
array('http://', '276.1.2', 'http:///276.1.2'), |
603
|
|
|
array('http://', '192.168.0.1 hello', 'http:///192.168.0.1 hello'), |
604
|
|
|
array('http://', '0000000000000300.0x00000000000000fF.00000000000000001', 'http:///0000000000000300.0x00000000000000fF.00000000000000001'), |
605
|
|
|
array('http://', '0000000000000300.0xffffffffFFFFFFFF.3022415481470977', 'http:///0000000000000300.0xffffffffFFFFFFFF.3022415481470977'), |
606
|
|
|
array('http://', '00000000000000000001', 'http:///00000000000000000001'), |
607
|
|
|
array('http://', '0000000000000000100000000000000001', 'http:///0000000000000000100000000000000001'), |
608
|
|
|
array('http://', '0.0.0.000000000000000000z', 'http:///0.0.0.000000000000000000z'), |
609
|
|
|
array('http://', '0.0.0.100000000000000000z', 'http:///0.0.0.100000000000000000z'), |
610
|
|
|
array('http://', '0.00.0x.0x0', 'http:///0.00.0x.0x0'), |
611
|
|
|
array('http://', '[', 'http:///['), |
612
|
|
|
array('http://', '[:', '[:'), |
613
|
|
|
array('http://', ']', 'http:///]'), |
614
|
|
|
array('http://', ':]', 'http:///:]'), |
615
|
|
|
array('http://', '[]', 'http:///[]'), |
616
|
|
|
array('http://', '[:]', '[:]'), |
617
|
|
|
array('http://', '2001:db8::1', '2001:db8::1'), |
618
|
|
|
array('http://', '[2001:db8::1', '[2001:db8::1'), |
619
|
|
|
array('http://', '2001:db8::1]', '2001:db8::1]'), |
620
|
|
|
array('http://', '[::]', '[::]'), |
621
|
|
|
array('http://', '[::1]', '[::1]'), |
622
|
|
|
array('http://', '[1::]', '[1::]'), |
623
|
|
|
array('http://', '[::192.168.0.1]', '[::192.168.0.1]'), |
624
|
|
|
array('http://', '[::ffff:192.168.0.1]', '[::ffff:192.168.0.1]'), |
625
|
|
|
array('http://', '[000:01:02:003:004:5:6:007]', '[000:01:02:003:004:5:6:007]'), |
626
|
|
|
array('http://', '[A:b:c:DE:fF:0:1:aC]', '[A:b:c:DE:fF:0:1:aC]'), |
627
|
|
|
array('http://', '[1:0:0:2::3:0]', '[1:0:0:2::3:0]'), |
628
|
|
|
array('http://', '[1::2:0:0:3:0]', '[1::2:0:0:3:0]'), |
629
|
|
|
array('http://', '[::eeee:192.168.0.1]', '[::eeee:192.168.0.1]'), |
630
|
|
|
array('http://', '[2001::192.168.0.1]', '[2001::192.168.0.1]'), |
631
|
|
|
array('http://', '[1:2:192.168.0.1:5:6]', '[1:2:192.168.0.1:5:6]'), |
632
|
|
|
array('http://', '[::ffff:192.1.2]', '[::ffff:192.1.2]'), |
633
|
|
|
array('http://', '[::ffff:0xC0.0Xa8.0x0.0x1]', '[::ffff:0xC0.0Xa8.0x0.0x1]'), |
634
|
|
|
array('http://', '[0:0::0:0:8]', '[0:0::0:0:8]'), |
635
|
|
|
array('http://', '[2001:db8::1]', '[2001:db8::1]'), |
636
|
|
|
array('http://', '[2001::db8::1]', '[2001::db8::1]'), |
637
|
|
|
array('http://', '[2001:db8:::1]', '[2001:db8:::1]'), |
638
|
|
|
array('http://', '[:::]', '[:::]'), |
639
|
|
|
array('http://', '[2001::.com]', '[2001::.com]'), |
640
|
|
|
array('http://', '[::192.168.0.0.1]', '[::192.168.0.0.1]'), |
641
|
|
|
array('http://', '[::ffff:192.168.0.0.1]', '[::ffff:192.168.0.0.1]'), |
642
|
|
|
array('http://', '[1:2:3:4:5:6:7:8:9]', '[1:2:3:4:5:6:7:8:9]'), |
643
|
|
|
array('http://', '[0:0:0:0:0:0:0:192.168.0.1]', '[0:0:0:0:0:0:0:192.168.0.1]'), |
644
|
|
|
array('http://', '[1:2:3:4:5:6::192.168.0.1]', '[1:2:3:4:5:6::192.168.0.1]'), |
645
|
|
|
array('http://', '[1:2:3:4:5:6::8]', '[1:2:3:4:5:6::8]'), |
646
|
|
|
array('http://', '[1:2:3:4:5:6:7:8:]', '[1:2:3:4:5:6:7:8:]'), |
647
|
|
|
array('http://', '[1:2:3:4:5:6:192.168.0.1:]', '[1:2:3:4:5:6:192.168.0.1:]'), |
648
|
|
|
array('http://', '[-1:2:3:4:5:6:7:8]', '[-1:2:3:4:5:6:7:8]'), |
649
|
|
|
array('http://', '[1::%1]', '[1::%1]'), |
650
|
|
|
array('http://', '[1::%eth0]', '[1::%eth0]'), |
651
|
|
|
array('http://', '[1::%]', '[1::%]'), |
652
|
|
|
array('http://', '[%]', 'http:///[%]'), |
653
|
|
|
array('http://', '[::%:]', '[::%:]'), |
654
|
|
|
array('http://', '[:0:0::0:0:8]', '[:0:0::0:0:8]'), |
655
|
|
|
array('http://', '[0:0::0:0:8:]', '[0:0::0:0:8:]'), |
656
|
|
|
array('http://', '[:0:0::0:0:8:]', '[:0:0::0:0:8:]'), |
657
|
|
|
array('http://', '[::192.168..1]', '[::192.168..1]'), |
658
|
|
|
array('http://', '[::1 hello]', '[::1 hello]'), |
659
|
|
|
array('mailto:', 'addr1', 'mailto:addr1'), |
660
|
|
|
array('mailto:', '[email protected]', 'mailto:[email protected]'), |
661
|
|
|
array('mailto:', 'addr1 \\t', 'mailto:addr1 \\t'), |
662
|
|
|
array('mailto:', 'addr1?to=jon', 'mailto:addr1?to=jon'), |
663
|
|
|
array('mailto:', 'addr1,addr2', 'mailto:addr1,addr2'), |
664
|
|
|
array('mailto:', 'addr1, addr2', 'mailto:addr1, addr2'), |
665
|
|
|
array('mailto:', 'addr1%2caddr2', 'mailto:addr1%2caddr2'), |
666
|
|
|
array('mailto:', 'addr1?', 'mailto:addr1?'), |
667
|
|
|
array('http://www.example.com', '/././foo', 'http://www.example.com/foo'), |
668
|
|
|
array('http://www.example.com', '/./.foo', 'http://www.example.com/.foo'), |
669
|
|
|
array('http://www.example.com', '/foo/.', 'http://www.example.com/foo/'), |
670
|
|
|
array('http://www.example.com', '/foo/./', 'http://www.example.com/foo/'), |
671
|
|
|
array('http://www.example.com', '/foo/bar/..', 'http://www.example.com/foo/'), |
672
|
|
|
array('http://www.example.com', '/foo/bar/../', 'http://www.example.com/foo/'), |
673
|
|
|
array('http://www.example.com', '/foo/..bar', 'http://www.example.com/foo/..bar'), |
674
|
|
|
array('http://www.example.com', '/foo/bar/../ton', 'http://www.example.com/foo/ton'), |
675
|
|
|
array('http://www.example.com', '/foo/bar/../ton/../../a', 'http://www.example.com/a'), |
676
|
|
|
array('http://www.example.com', '/foo/../../..', 'http://www.example.com/'), |
677
|
|
|
array('http://www.example.com', '/foo/../../../ton', 'http://www.example.com/ton'), |
678
|
|
|
array('http://www.example.com', '/foo/%2e', 'http://www.example.com/foo/%2e'), |
679
|
|
|
array('http://www.example.com', '/foo/%2e%2', 'http://www.example.com/foo/%2e%2'), |
680
|
|
|
array('http://www.example.com', '/foo/%2e./%2e%2e/.%2e/%2e.bar', 'http://www.example.com/foo/%2e./%2e%2e/.%2e/%2e.bar'), |
681
|
|
|
array('http://www.example.com', '////../..', 'http:///'), |
682
|
|
|
array('http://www.example.com', '/foo/bar//../..', 'http://www.example.com/foo/'), |
683
|
|
|
array('http://www.example.com', '/foo/bar//..', 'http://www.example.com/foo/bar/'), |
684
|
|
|
array('http://www.example.com', '/foo/bar/..', 'http://www.example.com/foo/'), |
685
|
|
|
array('http://www.example.com', '/foo', 'http://www.example.com/foo'), |
686
|
|
|
array('http://www.example.com', '/%20foo', 'http://www.example.com/%20foo'), |
687
|
|
|
array('http://www.example.com', '/foo%', 'http://www.example.com/foo%'), |
688
|
|
|
array('http://www.example.com', '/foo%2', 'http://www.example.com/foo%2'), |
689
|
|
|
array('http://www.example.com', '/foo%2zbar', 'http://www.example.com/foo%2zbar'), |
690
|
|
|
array('http://www.example.com', '/foo%41%7a', 'http://www.example.com/foo%41%7a'), |
691
|
|
|
array('http://www.example.com', '/foo%00%51', 'http://www.example.com/foo%00%51'), |
692
|
|
|
array('http://www.example.com', '/(%28:%3A%29)', 'http://www.example.com/(%28:%3A%29)'), |
693
|
|
|
array('http://www.example.com', '/%3A%3a%3C%3c', 'http://www.example.com/%3A%3a%3C%3c'), |
694
|
|
|
array('http://www.example.com', '/foo\\tbar', 'http://www.example.com/foo\\tbar'), |
695
|
|
|
array('http://www.example.com', '\\\\foo\\\\bar', 'http://www.example.com/\\\\foo\\\\bar'), |
696
|
|
|
array('http://www.example.com', '/%7Ffp3%3Eju%3Dduvgw%3Dd', 'http://www.example.com/%7Ffp3%3Eju%3Dduvgw%3Dd'), |
697
|
|
|
array('http://www.example.com', '/@asdf%40', 'http://www.example.com/@asdf%40'), |
698
|
|
|
array('http://www.example.com:', 'as df', 'http://www.example.com:/as df'), |
699
|
|
|
array('http://www.example.com:', '-2', 'http://www.example.com:/-2'), |
700
|
|
|
array('http://www.example.com:', '80', 'http://www.example.com:/80'), |
701
|
|
|
array('http://www.example.com:', '8080', 'http://www.example.com:/8080'), |
702
|
|
|
array('http://www.example.com:', '', 'http://www.example.com:'), |
703
|
|
|
array('http://www.example.com/?', 'foo=bar', 'http://www.example.com/foo=bar'), |
704
|
|
|
array('http://www.example.com/?', 'as?df', 'http://www.example.com/as?df'), |
705
|
|
|
array('http://www.example.com/?', '\\%02hello%7f bye', 'http://www.example.com/\\%02hello%7f bye'), |
706
|
|
|
array('http://www.example.com/?', '%40%41123', 'http://www.example.com/%40%41123'), |
707
|
|
|
array('http://www.example.com/?', 'q=<asdf>', 'http://www.example.com/q=<asdf>'), |
708
|
|
|
array('http://www.example.com/?', 'q=\\"asdf\\"', 'http://www.example.com/q=\\"asdf\\"'), |
709
|
|
|
array('http://host/a', '\\\\\\\\Another\\\\path', 'http://host/\\\\\\\\Another\\\\path'), |
710
|
|
|
array('http://host/a', '/c:\\\\foo', 'http://host/c:\\\\foo'), |
711
|
|
|
array('http://host/a', '//c:\\\\foo', 'http://c:\\\\foo'), |
712
|
|
|
array('file:///C:/foo', 'http://host/', 'http://host/'), |
713
|
|
|
array('file:///C:/foo', 'bar', 'file:///C:/bar'), |
714
|
|
|
array('file:///C:/foo', '../../../bar.html', 'file:///bar.html'), |
715
|
|
|
array('file:///C:/foo', '/../bar.html', 'file:///bar.html'), |
716
|
|
|
array('http://host/a', '\\\\\\\\another\\\\path', 'http://host/\\\\\\\\another\\\\path'), |
717
|
|
|
array('file:///C:/something', '//c:/foo', 'file://c:/foo'), |
718
|
|
|
array('file:///C:/something', '//localhost/c:/foo', 'file://localhost/c:/foo'), |
719
|
|
|
array('file:///C:/foo', 'c:', 'c:'), |
720
|
|
|
array('file:///C:/foo', 'c:/foo', 'c:/foo'), |
721
|
|
|
array('http://host/a', 'c:\\\\foo', 'c:\\\\foo'), |
722
|
|
|
array('file:///C:/foo', '/z:/bar', 'file:///z:/bar'), |
723
|
|
|
array('file:///C:/foo', '/bar', 'file:///bar'), |
724
|
|
|
array('file://localhost/C:/foo', '/bar', 'file://localhost/bar'), |
725
|
|
|
array('file:///C:/foo/com/', '/bar', 'file:///bar'), |
726
|
|
|
array('file:///C:/something', '//somehost/path', 'file://somehost/path'), |
727
|
|
|
array('file:///C:/something', '/\\\\//somehost/path', 'file:///\\\\//somehost/path'), |
728
|
|
|
array('http://host/a', 'http://another/', 'http://another/'), |
729
|
|
|
array('http://host/a', 'http:////another/', 'http:////another/'), |
730
|
|
|
array('http://foo/bar', '', 'http://foo/bar'), |
731
|
|
|
array('http://foo/bar#ref', '', 'http://foo/bar'), |
732
|
|
|
array('http://foo/bar#', '', 'http://foo/bar'), |
733
|
|
|
array('http://foo/bar', ' another ', 'http://foo/ another '), |
734
|
|
|
array('http://foo/bar', ' . ', 'http://foo/ . '), |
735
|
|
|
array('http://foo/bar', ' \\t', 'http://foo/ \\t'), |
736
|
|
|
array('http://host/a', 'http:path', 'http:path'), |
737
|
|
|
array('http://host/a/', 'http:path', 'http:path'), |
738
|
|
|
array('http://host/a', 'http:/path', 'http:/path'), |
739
|
|
|
array('http://host/a', 'HTTP:/path', 'HTTP:/path'), |
740
|
|
|
array('http://host/a', 'https:host2', 'https:host2'), |
741
|
|
|
array('http://host/a', 'htto:/host2', 'htto:/host2'), |
742
|
|
|
array('http://host/a', '/b/c/d', 'http://host/b/c/d'), |
743
|
|
|
array('http://host/a', '\\\\b\\\\c\\\\d', 'http://host/\\\\b\\\\c\\\\d'), |
744
|
|
|
array('http://host/a', '/b/../c', 'http://host/c'), |
745
|
|
|
array('http://host/a?b#c', '/b/../c', 'http://host/c'), |
746
|
|
|
array('http://host/a', '\\\\b/../c?x#y', 'http://host/c?x#y'), |
747
|
|
|
array('http://host/a?b#c', '/b/../c?x#y', 'http://host/c?x#y'), |
748
|
|
|
array('http://host/a', 'b', 'http://host/b'), |
749
|
|
|
array('http://host/a', 'bc/de', 'http://host/bc/de'), |
750
|
|
|
array('http://host/a/', 'bc/de?query#ref', 'http://host/a/bc/de?query#ref'), |
751
|
|
|
array('http://host/a/', '.', 'http://host/a/'), |
752
|
|
|
array('http://host/a/', '..', 'http://host/'), |
753
|
|
|
array('http://host/a/', './..', 'http://host/'), |
754
|
|
|
array('http://host/a/', '../.', 'http://host/'), |
755
|
|
|
array('http://host/a/', '././.', 'http://host/a/'), |
756
|
|
|
array('http://host/a?query#ref', '../../../foo', 'http://host/foo'), |
757
|
|
|
array('http://host/a', '?foo=bar', 'http://host/a?foo=bar'), |
758
|
|
|
array('http://host/a?x=y#z', '?', 'http://host/a?'), |
759
|
|
|
array('http://host/a?x=y#z', '?foo=bar#com', 'http://host/a?foo=bar#com'), |
760
|
|
|
array('http://host/a', '#ref', 'http://host/a#ref'), |
761
|
|
|
array('http://host/a#b', '#', 'http://host/a#'), |
762
|
|
|
array('http://host/a?foo=bar#hello', '#bye', 'http://host/a?foo=bar#bye'), |
763
|
|
|
array('data:foobar', 'baz.html', 'data:baz.html'), |
764
|
|
|
array('data:foobar', 'data:baz', 'data:baz'), |
765
|
|
|
array('data:foobar', 'data:/base', 'data:/base'), |
766
|
|
|
array('data:foobar', 'http://host/', 'http://host/'), |
767
|
|
|
array('data:foobar', 'http:host', 'http:host'), |
768
|
|
|
array('http://foo/bar', './asd:fgh', 'http://foo/asd:fgh'), |
769
|
|
|
array('http://foo/bar', ':foo', 'http://foo/:foo'), |
770
|
|
|
array('http://foo/bar', ' hello world', 'http://foo/ hello world'), |
771
|
|
|
array('data:asdf', ':foo', 'data::foo'), |
772
|
|
|
array('http://host/a', ';foo', 'http://host/;foo'), |
773
|
|
|
array('http://host/a;', ';foo', 'http://host/;foo'), |
774
|
|
|
array('http://host/a', ';/../bar', 'http://host/bar'), |
775
|
|
|
array('http://host/a', '//another', 'http://another'), |
776
|
|
|
array('http://host/a', '//another/path?query#ref', 'http://another/path?query#ref'), |
777
|
|
|
array('http://host/a', '///another/path', 'http:///another/path'), |
778
|
|
|
array('http://host/a', '//Another\\\\path', 'http://Another\\\\path'), |
779
|
|
|
array('http://host/a', '//', 'http://'), |
780
|
|
|
array('http://host/a', '\\\\/another/path', 'http://host/\\\\/another/path'), |
781
|
|
|
array('http://host/a', '/\\\\Another\\\\path', 'http://host/\\\\Another\\\\path'), |
782
|
|
|
array('data:text/plain,baseURL', 'http://user:pass@foo:21/bar;par?b#c', 'http://user:pass@foo:21/bar;par?b#c'), |
783
|
|
|
array('data:text/plain,baseURL', 'http:foo.com', 'http:foo.com'), |
784
|
|
|
array('data:text/plain,baseURL', ' foo.com ', 'data:text/ foo.com '), |
785
|
|
|
array('data:text/plain,baseURL', 'http://f:21/ b ? d # e ', 'http://f:21/ b ? d # e '), |
786
|
|
|
array('data:text/plain,baseURL', 'http://f:/c', 'http://f:/c'), |
787
|
|
|
array('data:text/plain,baseURL', 'http://f:0/c', 'http://f:0/c'), |
788
|
|
|
array('data:text/plain,baseURL', 'http://f:00000000000000/c', 'http://f:00000000000000/c'), |
789
|
|
|
array('data:text/plain,baseURL', 'http://f:00000000000000000000080/c', 'http://f:00000000000000000000080/c'), |
790
|
|
|
array('data:text/plain,baseURL', 'http://f:b/c', 'http://f:b/c'), |
791
|
|
|
array('data:text/plain,baseURL', 'http://f: /c', 'http://f: /c'), |
792
|
|
|
array('data:text/plain,baseURL', 'http://f:fifty-two/c', 'http://f:fifty-two/c'), |
793
|
|
|
array('data:text/plain,baseURL', 'http://f:999999/c', 'http://f:999999/c'), |
794
|
|
|
array('data:text/plain,baseURL', 'http://f: 21 / b ? d # e ', 'http://f: 21 / b ? d # e '), |
795
|
|
|
array('data:text/plain,baseURL', '', 'data:text/plain,baseURL'), |
796
|
|
|
array('data:text/plain,baseURL', ':foo.com/', 'data:text/:foo.com/'), |
797
|
|
|
array('data:text/plain,baseURL', ':foo.com\\\\', 'data:text/:foo.com\\\\'), |
798
|
|
|
array('data:text/plain,baseURL', ':', 'data:text/:'), |
799
|
|
|
array('data:text/plain,baseURL', ':a', 'data:text/:a'), |
800
|
|
|
array('data:text/plain,baseURL', ':/', 'data:text/:/'), |
801
|
|
|
array('data:text/plain,baseURL', ':\\\\', 'data:text/:\\\\'), |
802
|
|
|
array('data:text/plain,baseURL', ':#', 'data:text/:#'), |
803
|
|
|
array('data:text/plain,baseURL', '#', 'data:text/plain,baseURL#'), |
804
|
|
|
array('data:text/plain,baseURL', '#/', 'data:text/plain,baseURL#/'), |
805
|
|
|
array('data:text/plain,baseURL', '#\\\\', 'data:text/plain,baseURL#\\\\'), |
806
|
|
|
array('data:text/plain,baseURL', '#;?', 'data:text/plain,baseURL#;?'), |
807
|
|
|
array('data:text/plain,baseURL', '?', 'data:text/plain,baseURL?'), |
808
|
|
|
array('data:text/plain,baseURL', '/', 'data:/'), |
809
|
|
|
array('data:text/plain,baseURL', ':23', 'data:text/:23'), |
810
|
|
|
array('data:text/plain,baseURL', '/:23', 'data:/:23'), |
811
|
|
|
array('data:text/plain,baseURL', '//', 'data://'), |
812
|
|
|
array('data:text/plain,baseURL', '::', 'data:text/::'), |
813
|
|
|
array('data:text/plain,baseURL', '::23', 'data:text/::23'), |
814
|
|
|
array('data:text/plain,baseURL', 'foo://', 'foo://'), |
815
|
|
|
array('data:text/plain,baseURL', 'http://a:b@c:29/d', 'http://a:b@c:29/d'), |
816
|
|
|
array('data:text/plain,baseURL', 'http::@c:29', 'http::@c:29'), |
817
|
|
|
array('data:text/plain,baseURL', 'http://&a:foo(b]c@d:2/', 'http://&a:foo(b]c@d:2/'), |
818
|
|
|
array('data:text/plain,baseURL', 'http://::@c@d:2', 'http://::@c@d:2'), |
819
|
|
|
array('data:text/plain,baseURL', 'http://foo.com:b@d/', 'http://foo.com:b@d/'), |
820
|
|
|
array('data:text/plain,baseURL', 'http://foo.com/\\\\@', 'http://foo.com/\\\\@'), |
821
|
|
|
array('data:text/plain,baseURL', 'http:\\\\\\\\foo.com\\\\', 'http:\\\\\\\\foo.com\\\\'), |
822
|
|
|
array('data:text/plain,baseURL', 'http:\\\\\\\\a\\\\b:c\\\\[email protected]\\\\', 'http:\\\\\\\\a\\\\b:c\\\\[email protected]\\\\'), |
823
|
|
|
array('data:text/plain,baseURL', 'foo:/', 'foo:/'), |
824
|
|
|
array('data:text/plain,baseURL', 'foo:/bar.com/', 'foo:/bar.com/'), |
825
|
|
|
array('data:text/plain,baseURL', 'foo://///////', 'foo://///////'), |
826
|
|
|
array('data:text/plain,baseURL', 'foo://///////bar.com/', 'foo://///////bar.com/'), |
827
|
|
|
array('data:text/plain,baseURL', 'foo:////://///', 'foo:////://///'), |
828
|
|
|
array('data:text/plain,baseURL', 'c:/foo', 'c:/foo'), |
829
|
|
|
array('data:text/plain,baseURL', '//foo/bar', 'data://foo/bar'), |
830
|
|
|
array('data:text/plain,baseURL', 'http://foo/path;a??e#f#g', 'http://foo/path;a??e#f#g'), |
831
|
|
|
array('data:text/plain,baseURL', 'http://foo/abcd?efgh?ijkl', 'http://foo/abcd?efgh?ijkl'), |
832
|
|
|
array('data:text/plain,baseURL', 'http://foo/abcd#foo?bar', 'http://foo/abcd#foo?bar'), |
833
|
|
|
array('data:text/plain,baseURL', '[61:24:74]:98', '[61:24:74]:98'), |
834
|
|
|
array('data:text/plain,baseURL', 'http://[61:27]:98', 'http://[61:27]:98'), |
835
|
|
|
array('data:text/plain,baseURL', 'http:[61:27]/:foo', 'http:[61:27]/:foo'), |
836
|
|
|
array('data:text/plain,baseURL', 'http://[1::2]:3:4', 'http://[1::2]:3:4'), |
837
|
|
|
array('data:text/plain,baseURL', 'http://2001::1', 'http://2001::1'), |
838
|
|
|
array('data:text/plain,baseURL', 'http://[2001::1', 'http://[2001::1'), |
839
|
|
|
array('data:text/plain,baseURL', 'http://2001::1]', 'http://2001::1]'), |
840
|
|
|
array('data:text/plain,baseURL', 'http://2001::1]:80', 'http://2001::1]:80'), |
841
|
|
|
array('data:text/plain,baseURL', 'http://[2001::1]', 'http://[2001::1]'), |
842
|
|
|
array('data:text/plain,baseURL', 'http://[2001::1]:80', 'http://[2001::1]:80'), |
843
|
|
|
array('data:text/plain,baseURL', 'http://[[::]]', 'http://[[::]]'), |
844
|
|
|
array('http://www.example.com/foo/bar', 'http://user:pass@foo:21/bar;par?b#c', 'http://user:pass@foo:21/bar;par?b#c'), |
845
|
|
|
array('http://www.example.com/foo/bar', 'http:foo.com', 'http:foo.com'), |
846
|
|
|
array('http://www.example.com/foo/bar', ' foo.com ', 'http://www.example.com/foo/ foo.com '), |
847
|
|
|
array('http://www.example.com/foo/bar', 'http://f:21/ b ? d # e ', 'http://f:21/ b ? d # e '), |
848
|
|
|
array('http://www.example.com/foo/bar', 'http://f:/c', 'http://f:/c'), |
849
|
|
|
array('http://www.example.com/foo/bar', 'http://f:0/c', 'http://f:0/c'), |
850
|
|
|
array('http://www.example.com/foo/bar', 'http://f:00000000000000/c', 'http://f:00000000000000/c'), |
851
|
|
|
array('http://www.example.com/foo/bar', 'http://f:00000000000000000000080/c', 'http://f:00000000000000000000080/c'), |
852
|
|
|
array('http://www.example.com/foo/bar', 'http://f:b/c', 'http://f:b/c'), |
853
|
|
|
array('http://www.example.com/foo/bar', 'http://f: /c', 'http://f: /c'), |
854
|
|
|
array('http://www.example.com/foo/bar', 'http://f:fifty-two/c', 'http://f:fifty-two/c'), |
855
|
|
|
array('http://www.example.com/foo/bar', 'http://f:999999/c', 'http://f:999999/c'), |
856
|
|
|
array('http://www.example.com/foo/bar', 'http://f: 21 / b ? d # e ', 'http://f: 21 / b ? d # e '), |
857
|
|
|
array('http://www.example.com/foo/bar', '', 'http://www.example.com/foo/bar'), |
858
|
|
|
array('http://www.example.com/foo/bar', ':foo.com/', 'http://www.example.com/foo/:foo.com/'), |
859
|
|
|
array('http://www.example.com/foo/bar', ':foo.com\\\\', 'http://www.example.com/foo/:foo.com\\\\'), |
860
|
|
|
array('http://www.example.com/foo/bar', ':', 'http://www.example.com/foo/:'), |
861
|
|
|
array('http://www.example.com/foo/bar', ':a', 'http://www.example.com/foo/:a'), |
862
|
|
|
array('http://www.example.com/foo/bar', ':/', 'http://www.example.com/foo/:/'), |
863
|
|
|
array('http://www.example.com/foo/bar', ':\\\\', 'http://www.example.com/foo/:\\\\'), |
864
|
|
|
array('http://www.example.com/foo/bar', ':#', 'http://www.example.com/foo/:#'), |
865
|
|
|
array('http://www.example.com/foo/bar', '#', 'http://www.example.com/foo/bar#'), |
866
|
|
|
array('http://www.example.com/foo/bar', '#/', 'http://www.example.com/foo/bar#/'), |
867
|
|
|
array('http://www.example.com/foo/bar', '#\\\\', 'http://www.example.com/foo/bar#\\\\'), |
868
|
|
|
array('http://www.example.com/foo/bar', '#;?', 'http://www.example.com/foo/bar#;?'), |
869
|
|
|
array('http://www.example.com/foo/bar', '?', 'http://www.example.com/foo/bar?'), |
870
|
|
|
array('http://www.example.com/foo/bar', '/', 'http://www.example.com/'), |
871
|
|
|
array('http://www.example.com/foo/bar', ':23', 'http://www.example.com/foo/:23'), |
872
|
|
|
array('http://www.example.com/foo/bar', '/:23', 'http://www.example.com/:23'), |
873
|
|
|
array('http://www.example.com/foo/bar', '//', 'http://'), |
874
|
|
|
array('http://www.example.com/foo/bar', '::', 'http://www.example.com/foo/::'), |
875
|
|
|
array('http://www.example.com/foo/bar', '::23', 'http://www.example.com/foo/::23'), |
876
|
|
|
array('http://www.example.com/foo/bar', 'foo://', 'foo://'), |
877
|
|
|
array('http://www.example.com/foo/bar', 'http://a:b@c:29/d', 'http://a:b@c:29/d'), |
878
|
|
|
array('http://www.example.com/foo/bar', 'http::@c:29', 'http::@c:29'), |
879
|
|
|
array('http://www.example.com/foo/bar', 'http://&a:foo(b]c@d:2/', 'http://&a:foo(b]c@d:2/'), |
880
|
|
|
array('http://www.example.com/foo/bar', 'http://::@c@d:2', 'http://::@c@d:2'), |
881
|
|
|
array('http://www.example.com/foo/bar', 'http://foo.com:b@d/', 'http://foo.com:b@d/'), |
882
|
|
|
array('http://www.example.com/foo/bar', 'http://foo.com/\\\\@', 'http://foo.com/\\\\@'), |
883
|
|
|
array('http://www.example.com/foo/bar', 'http:\\\\\\\\foo.com\\\\', 'http:\\\\\\\\foo.com\\\\'), |
884
|
|
|
array('http://www.example.com/foo/bar', 'http:\\\\\\\\a\\\\b:c\\\\[email protected]\\\\', 'http:\\\\\\\\a\\\\b:c\\\\[email protected]\\\\'), |
885
|
|
|
array('http://www.example.com/foo/bar', 'foo:/', 'foo:/'), |
886
|
|
|
array('http://www.example.com/foo/bar', 'foo:/bar.com/', 'foo:/bar.com/'), |
887
|
|
|
array('http://www.example.com/foo/bar', 'foo://///////', 'foo://///////'), |
888
|
|
|
array('http://www.example.com/foo/bar', 'foo://///////bar.com/', 'foo://///////bar.com/'), |
889
|
|
|
array('http://www.example.com/foo/bar', 'foo:////://///', 'foo:////://///'), |
890
|
|
|
array('http://www.example.com/foo/bar', 'c:/foo', 'c:/foo'), |
891
|
|
|
array('http://www.example.com/foo/bar', '//foo/bar', 'http://foo/bar'), |
892
|
|
|
array('http://www.example.com/foo/bar', 'http://foo/path;a??e#f#g', 'http://foo/path;a??e#f#g'), |
893
|
|
|
array('http://www.example.com/foo/bar', 'http://foo/abcd?efgh?ijkl', 'http://foo/abcd?efgh?ijkl'), |
894
|
|
|
array('http://www.example.com/foo/bar', 'http://foo/abcd#foo?bar', 'http://foo/abcd#foo?bar'), |
895
|
|
|
array('http://www.example.com/foo/bar', '[61:24:74]:98', '[61:24:74]:98'), |
896
|
|
|
array('http://www.example.com/foo/bar', 'http://[61:27]:98', 'http://[61:27]:98'), |
897
|
|
|
array('http://www.example.com/foo/bar', 'http:[61:27]/:foo', 'http:[61:27]/:foo'), |
898
|
|
|
array('http://www.example.com/foo/bar', 'http://[1::2]:3:4', 'http://[1::2]:3:4'), |
899
|
|
|
array('http://www.example.com/foo/bar', 'http://2001::1', 'http://2001::1'), |
900
|
|
|
array('http://www.example.com/foo/bar', 'http://[2001::1', 'http://[2001::1'), |
901
|
|
|
array('http://www.example.com/foo/bar', 'http://2001::1]', 'http://2001::1]'), |
902
|
|
|
array('http://www.example.com/foo/bar', 'http://2001::1]:80', 'http://2001::1]:80'), |
903
|
|
|
array('http://www.example.com/foo/bar', 'http://[2001::1]', 'http://[2001::1]'), |
904
|
|
|
array('http://www.example.com/foo/bar', 'http://[2001::1]:80', 'http://[2001::1]:80'), |
905
|
|
|
array('http://www.example.com/foo/bar', 'http://[[::]]', 'http://[[::]]'), |
906
|
|
|
array('http://example.org/foo/bar', 'http://example.com/', 'http://example.com/'), |
907
|
|
|
array('http://example.org/foo/bar', 'http://example.com/', 'http://example.com/'), |
908
|
|
|
array('http://example.org/foo/bar', '/', 'http://example.org/'), |
909
|
|
|
array('http://iris.test.ing/', '?value= foo bar', 'http://iris.test.ing/?value= foo bar'), |
910
|
|
|
array('http://user%40', 'example.com', 'http://user%40/example.com'), |
911
|
|
|
array('http://user%3Ainfo%40', 'example.com', 'http://user%3Ainfo%40/example.com'), |
912
|
|
|
array('http://user@', 'example.com', 'http://user@/example.com'), |
913
|
|
|
array('http://user:info@', 'example.com', 'http://user:info@/example.com') |
914
|
|
|
); |
915
|
|
|
} |
916
|
|
|
|
917
|
|
|
/** |
918
|
|
|
* Test conversion to relative IRI reference |
919
|
|
|
* |
920
|
|
|
* @param string $iri The reference IRI to convert to a |
921
|
|
|
* relative reference. |
922
|
|
|
* @param string $base The base IRI. |
923
|
|
|
* @param bool $schemaRelative Should schema-relative IRIs be created? |
924
|
|
|
* @param string $expected The expected IRI reference. |
925
|
|
|
* |
926
|
|
|
* @dataProvider relativizeProvider |
927
|
|
|
*/ |
928
|
|
|
public function testRelativize($iri, $base, $schemaRelative, $expected) |
929
|
|
|
{ |
930
|
|
|
$iri = new IRI($iri); |
931
|
|
|
$this->assertEquals($expected, (string)$iri->relativeTo($base, $schemaRelative)); |
932
|
|
|
|
933
|
|
|
$base = new IRI($base); |
934
|
|
|
$this->assertEquals($expected, (string)$base->baseFor((string)$iri, $schemaRelative)); |
935
|
|
|
} |
936
|
|
|
|
937
|
|
|
/** |
938
|
|
|
* Conversion to relative IRI reference test cases |
939
|
|
|
* |
940
|
|
|
* These test cases are adaptations of the tests in |
941
|
|
|
* {@link http://dig.csail.mit.edu/2005/ajar/ajaw/test/uri-test-doc.html}. |
942
|
|
|
* |
943
|
|
|
* @return array The test cases. |
944
|
|
|
*/ |
945
|
|
|
public function relativizeProvider() |
946
|
|
|
{ |
947
|
|
|
return array( // $iri, $base, $schemaRelative, $expected |
|
|
|
|
948
|
|
|
array('http://example.com/x/y?k=v', 'http://example.com', false, '/x/y?k=v'), |
949
|
|
|
array('http://ex/x/y/z', 'http://ex/x/y/z', false, 'z'), |
950
|
|
|
array('https://example.com/x/y/z', 'http://example.com/x/y/z', false, 'https://example.com/x/y/z'), |
951
|
|
|
array('http://example.com/x/y/z/', 'http://example.com/x/y/z/', false, './'), |
952
|
|
|
array('http://example.com/x/y/z/?query', 'http://example.com/x/y/z/', false, '?query'), |
953
|
|
|
array('http://example.com/x/y/z/#fragment', 'http://example.com/x/y/z/', false, '#fragment'), |
954
|
|
|
array('http://example.com/x/y/z', 'http://example.com/x/y/z', false, 'z'), |
955
|
|
|
array('http://example.com/x/y/z?query', 'http://example.com/x/y/z', false, '?query'), |
956
|
|
|
array('http://example.com/x/y/z#fragment', 'http://example.com/x/y/z', false, '#fragment'), |
957
|
|
|
array('http://example.com/x/y/z:a', 'http://example.com/x/y/', false, './z:a'), |
958
|
|
|
array('http://example.com/x/y/z', 'http://example.com/x/y', false, 'y/z'), |
959
|
|
|
array('http://example.com/x/y/z', 'http://example.com/a/b/c', false, '../../x/y/z'), |
960
|
|
|
array('http://example.com/x/y/z?query', 'http://example.com/a/b/c', false, '../../x/y/z?query'), |
961
|
|
|
array('http://example.com/x/y/z#fragment', 'http://example.com/a/b/c', false, '../../x/y/z#fragment'), |
962
|
|
|
array('http://example.com/x/y/z?query#fragment', 'http://example.com/a/b/c', false, '../../x/y/z?query#fragment'), |
963
|
|
|
array('http://example.org/x/y/z', 'http://example.com/a/b/c', false, 'http://example.org/x/y/z'), |
964
|
|
|
array('http://example.org/x/y/z', 'http://example.com/a/b/c', true, '//example.org/x/y/z'), |
965
|
|
|
array('http://example/x/abc', 'http://example/x/y/z', false, '../abc'), |
966
|
|
|
array('file:/ex/x/q/r#s', 'file:/ex/x/y', false, 'q/r#s'), |
967
|
|
|
array('http://ex/x/y', null, false, 'http://ex/x/y'), |
968
|
|
|
array('http://example.com/a', 'http://example.com/a/', false, '../a'), |
969
|
|
|
array('http://example.com/a', 'http://example.com/a/b', false, '../a'), |
970
|
|
|
array('http://example.com/a/b/c?query', 'http://example.com/a/b/c?query', false, '?query'), |
971
|
|
|
array('http://ex/r', 'http://ex/x/y/z', false, '../../r'), |
972
|
|
|
// http://dig.csail.mit.edu/2005/ajar/ajaw/test/uri-test-doc.html |
973
|
|
|
array('bar:abc', 'foo:xyz', false, 'bar:abc'), |
974
|
|
|
array('http://example/x/abc', 'http://example/x/y/z', false, '../abc'), |
975
|
|
|
array('http://example/x/abc', 'http://example2/x/y/z', false, 'http://example/x/abc'), |
976
|
|
|
array('http://example/x/abc', 'http://example2/x/y/z', true, '//example/x/abc'), |
977
|
|
|
array('http://ex/x/r', 'http://ex/x/y/z', false, '../r'), |
978
|
|
|
array('http://ex/x/q/r', 'http://ex/x/y', false, 'q/r'), |
979
|
|
|
array('http://ex/x/q/r#s', 'http://ex/x/y', false, 'q/r#s'), |
980
|
|
|
array('http://ex/x/q/r#s/t', 'http://ex/x/y', false, 'q/r#s/t'), |
981
|
|
|
array('ftp://ex/x/q/r', 'http://ex/x/y', false, 'ftp://ex/x/q/r'), |
982
|
|
|
array('http://ex/x/y/z/', 'http://ex/x/y', false, 'y/z/'), |
983
|
|
|
array('file:/swap/test/animal.rdf#Animal', 'file:/swap/test/animal.rdf', false, '#Animal'), |
984
|
|
|
array('file:/e/x/abc', 'file:/e/x/y/z', false, '../abc'), |
985
|
|
|
array('file:/example/x/abc', 'file:/example2/x/y/z', false, '../../../example/x/abc'), |
986
|
|
|
array('file:/ex/x/r', 'file:/ex/x/y/z', false, '../r'), |
987
|
|
|
array('file:/r', 'file:/ex/x/y/z', false, '../../../r'), |
988
|
|
|
array('file:/ex/x/q/r', 'file:/ex/x/y/z', false, '../q/r'), |
989
|
|
|
array('file:/ex/x/q/r#s', 'file:/ex/x/y', false, 'q/r#s'), |
990
|
|
|
array('file:/ex/x/q/r#', 'file:/ex/x/y', false, 'q/r#'), |
991
|
|
|
array('file:/ex/x/q/r#s/t', 'file:/ex/x/y', false, 'q/r#s/t'), |
992
|
|
|
array('ftp://ex/x/q/r', 'file:/ex/x/y', false, 'ftp://ex/x/q/r'), |
993
|
|
|
array('file:/ex/x/y/z/', 'file:/ex/x/y/', false, 'z/'), |
994
|
|
|
array('file://meetings.example.com/cal#m1', 'file:/devel/WWW/2000/10/swap/test/reluri-1.n3', false, 'file://meetings.example.com/cal#m1'), |
995
|
|
|
array('file://meetings.example.com/cal#m1', 'file:/devel/WWW/2000/10/swap/test/reluri-1.n3', true, '//meetings.example.com/cal#m1'), |
996
|
|
|
array('file://meetings.example.com/cal#m1', 'file:/home/connolly/w3ccvs/WWW/2000/10/swap/test/reluri-1.n3', false, 'file://meetings.example.com/cal#m1'), |
997
|
|
|
array('file://meetings.example.com/cal#m1', 'file:/home/connolly/w3ccvs/WWW/2000/10/swap/test/reluri-1.n3', true, '//meetings.example.com/cal#m1'), |
998
|
|
|
array('file:/some/dir/#blort', 'file:/some/dir/foo', false, './#blort'), |
999
|
|
|
array('file:/some/dir/#', 'file:/some/dir/foo', false, './#'), |
1000
|
|
|
array('http://example/x/abc', 'http://example/x/y%2Fz', false, 'abc'), |
1001
|
|
|
array('http://example/x%2Fabc', 'http://example/x/y/z', false, '../../x%2Fabc'), |
1002
|
|
|
array('http://example/x%2Fabc', 'http://example/x/y%2Fz', false, '../x%2Fabc'), |
1003
|
|
|
array('http://example/x%2Fy/abc', 'http://example/x%2Fy/z', false, 'abc'), |
1004
|
|
|
array('http://example/x/', 'http://example/x/abc.efg', false, './'), // ??? |
1005
|
|
|
array('http://www.w3.org/2002/01/tr-automation/tr.rdf', 'http://www.w3.org/People/Berners-Lee/card.rdf', false, '../../2002/01/tr-automation/tr.rdf'), |
1006
|
|
|
); |
1007
|
|
|
} |
1008
|
|
|
|
1009
|
|
|
/** |
1010
|
|
|
* Invalid IRI test cases |
1011
|
|
|
* |
1012
|
|
|
* These test cases were taken from |
1013
|
|
|
* {@link http://www.ninebynine.org/Software/HaskellUtils/Network/URITestDescriptions.html}. |
1014
|
|
|
* |
1015
|
|
|
* @return array The invalid IRI test cases. |
1016
|
|
|
*/ |
1017
|
|
|
public function invalidIriProvider() |
1018
|
|
|
{ |
1019
|
|
|
return array( |
1020
|
|
|
array('[2010:836B:4179::836B:4179]'), |
1021
|
|
|
array('http://foo.org:80Path/More'), |
1022
|
|
|
array('::'), |
1023
|
|
|
array(' '), // is this an invalid IRI?? |
1024
|
|
|
array('%'), |
1025
|
|
|
array('A%Z'), |
1026
|
|
|
array('%ZZ'), |
1027
|
|
|
array('%AZ'), |
1028
|
|
|
array('A C'), |
1029
|
|
|
array('A\C"'), |
1030
|
|
|
array('A`C'), |
1031
|
|
|
array('A<C'), |
1032
|
|
|
array('A>C'), |
1033
|
|
|
array('A^C'), |
1034
|
|
|
array('A\\C'), |
1035
|
|
|
array('A{C'), |
1036
|
|
|
array('A|C'), |
1037
|
|
|
array('A}C'), |
1038
|
|
|
array('A[C'), |
1039
|
|
|
array('A]C'), |
1040
|
|
|
array('A[**]C'), |
1041
|
|
|
array('http://[xyz]/'), |
1042
|
|
|
array('http://]/'), |
1043
|
|
|
array('http://example.org/[2010:836B:4179::836B:4179]'), |
1044
|
|
|
array('http://example.org/abc#[2010:836B:4179::836B:4179]'), |
1045
|
|
|
array('http://example.org/xxx/[qwerty]#a[b]'), |
1046
|
|
|
array('http://example.org/xxx/qwerty#a#b'), |
1047
|
|
|
array('http://user:[email protected]:99aaa/bbb') |
1048
|
|
|
); |
1049
|
|
|
} |
1050
|
|
|
|
1051
|
|
|
/** |
1052
|
|
|
* Normalization test cases |
1053
|
|
|
* |
1054
|
|
|
* These test cases were taken from |
1055
|
|
|
* {@link http://www.ninebynine.org/Software/HaskellUtils/Network/URITestDescriptions.html}. |
1056
|
|
|
* |
1057
|
|
|
* @return array The normalization test cases. |
1058
|
|
|
*/ |
1059
|
|
|
public function normalizationProvider() |
1060
|
|
|
{ |
1061
|
|
|
return array( |
1062
|
|
|
// Case normalization; cf. RFC3986 section 6.2.2.1 (NOTE: authority case normalization is not performed) |
1063
|
|
|
array('HTTP://EXAMPLE.com/Root/%2a?%2b#%2c', 'http://EXAMPLE.com/Root/%2A?%2B#%2C'), |
1064
|
|
|
// Encoding normalization; cf. RFC3986 section 6.2.2.2 |
1065
|
|
|
array('HTTP://EXAMPLE.com/Root/%7eMe/', 'HTTP://EXAMPLE.com/Root/~Me/'), |
1066
|
|
|
array('foo:%40%41%5a%5b%60%61%7a%7b%2f%30%39%3a%2d%2e%5f%7e', 'foo:%40AZ%5b%60az%7b%2f09%3a-._~'), |
1067
|
|
|
array('foo:%3a%2f%3f%23%5b%5d%40', 'foo:%3a%2f%3f%23%5b%5d%40'), |
1068
|
|
|
// Path segment normalization; cf. RFC3986 section 6.2.2.3 |
1069
|
|
|
array('http://example/a/b/../../c', 'http://example/c'), |
1070
|
|
|
array('http://example/a/b/c/../../', 'http://example/a/'), |
1071
|
|
|
array('http://example/a/b/c/./', 'http://example/a/b/c/'), |
1072
|
|
|
array('http://example/a/b/c/.././', 'http://example/a/b/'), |
1073
|
|
|
array('http://example/a/b/c/d/../../../../e', 'http://example/e'), |
1074
|
|
|
array('http://example/a/b/c/d/../.././../../e', 'http://example/e'), |
1075
|
|
|
array('http://example/a/b/../.././../../e', 'http://example/e'), |
1076
|
|
|
array('foo:a/b/../.././../../e', 'foo:e') |
1077
|
|
|
); |
1078
|
|
|
} |
1079
|
|
|
} |
1080
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.