URI relative reference beyond root path
am 20.05.2006 17:14:11 von masaoHello all,
In URI-1.35, a relative URI reference is interpreted as follows:
Rel. ref: ../index.html
Base URI: http://www.example.com/
=> http://www.example.com/../index.html
What I expected above was "http://www.example.com/index.html", as the
same as major browsers' behaviors.
I examined why different behaviors appeared. And I found out that
resolution of relative reference was slightly changed in RFC3986,
while the current implementation of URI module is based on RFC2396.
RFC3986 says:
5.4.2. Abnormal Examples
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 that
above.
Parsers must be careful in handling cases where there are more
".." segments in a relative-path reference 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.
"../../../g" = "http://a/g"
"../../../../g" = "http://a/g"
According to this definition the example above should be interpreted
as "http://www.example.com/index.html" as well as the browsers.
Is my understanding true?
If so, does anybody have a code for the new RFC3986?
Thanks in advance,
Masao Takaku // masao@nii.ac.jp