This section lists the examples from 5.4 Reference Resolution Examples of draft-fielding-uri-rfc2396bis-05.txt for testing by visual comparison. To test, move or place the cursor over the relative URI in the second column (relative), and compare the generated URI (e.g. in the status bar) with the absolute URI in the third column. Do not try to activate any of the links; all URIs are fictuous. If the two URIs match exactly, this test is passed. If there is any difference, the test is failed. Please report test results to the URI mailing list (uri@w3.org; publicly archived). Test results are listed here. Please send comments on this page to Martin Dürst.
The base URI for all the tests is http://a/b/c/d;p?q
number | relative | absolute |
---|---|---|
1 | g:h | g:h |
2 | g | http://a/b/c/g |
3 | ./g | http://a/b/c/g |
4 | g/ | http://a/b/c/g/ |
5 | /g | http://a/g |
6 | //g | http://g |
7 | ?y | http://a/b/c/d;p?y |
8 | g?y | http://a/b/c/g?y |
9 | #s | http://a/b/c/d;p?q#s |
10 | g#s | http://a/b/c/g#s |
11 | g?y#s | http://a/b/c/g?y#s |
12 | ;x | http://a/b/c/;x |
13 | g;x | http://a/b/c/g;x |
14 | g;x?y#s | http://a/b/c/g;x?y#s |
15 | "" | http://a/b/c/d;p?q |
16 | . | http://a/b/c/ |
17 | ./ | http://a/b/c/ |
18 | .. | http://a/b/ |
19 | ../ | http://a/b/ |
20 | ../g | http://a/b/g |
21 | ../.. | http://a/ |
22 | ../../ | http://a/ |
23 | ../../g | http://a/g |
number | relative | absolute |
---|---|---|
Although the following abnormal examples are unlikely to occur in normal practice, all URI parsers should be capable of resolving them consistently. Each example uses the same base as above. | ||
Parsers must be careful in handling cases where there are more relative path ".." segments than there are hierarchical levels in the base URI's path. Note that the ".." syntax cannot be used to change the authority component of a URI. | ||
31 | ../../../g | http://a/g |
32 | ../../../../g | http://a/g |
Similarly, parsers must remove the dot-segments "." and ".." when they are complete components of a path, but not when they are only part of a segment. | ||
41 | /./g | http://a/g |
42 | /../g | http://a/g |
43 | g. | http://a/b/c/g. |
44 | .g | http://a/b/c/.g |
45 | g.. | http://a/b/c/g.. |
46 | ..g | http://a/b/c/..g |
Less likely are cases where the relative URI reference uses unnecessary or nonsensical forms of the "." and ".." complete path segments. | ||
51 | ./../g | http://a/b/g |
52 | ./g/. | http://a/b/c/g/ |
53 | g/./h | http://a/b/c/g/h |
54 | g/../h | http://a/b/c/h |
55 | g;x=1/./y | http://a/b/c/g;x=1/y |
56 | g;x=1/../y | http://a/b/c/y |
Some applications fail to separate the reference's query and/or fragment components from a relative path before merging it with the base path and removing dot-segments. This error is rarely noticed, since typical usage of a fragment never includes the hierarchy ("/") character, and the query component is not normally used within relative references. | ||
61 | g?y/./x | http://a/b/c/g?y/./x |
62 | g?y/../x | http://a/b/c/g?y/../x |
63 | g#s/./x | http://a/b/c/g#s/./x |
64 | g#s/../x | http://a/b/c/g#s/../x |
Some parsers allow the scheme name to be present in a relative URI reference if it is the same as the base URI scheme. This is considered to be a loophole in prior specifications of partial URI [RFC1630]. Its use should be avoided, but is allowed for backward compatibility. | ||
71a | http:g | http:g (for strict parsers) |
71b | http:g | http://a/b/c/g (for backward
compatibility) |
These examples don't appear in the URI spec, but work the same way as those above.
number | relative | absolute |
---|---|---|
81 | ./g:h | http://a/b/c/g:h |
The test should go to the same location as the crosscheck.