对于url的相对路径问题一直都没太仔细弄清楚,这次好好的查了一下:
在rfc1630中有这样一段话:
The rules for the use of a partial name relative to the URI of the context are:
If the scheme parts are different, the whole absolute URI must be given. Otherwise, the scheme is omitted, and:
If the partial URI starts with a non-zero number of consecutive slashes, then everything from the context URI up to (but not including) the first occurrence of exactly the same number of consecutive slashes which has no greater number of consecutive slashes anywhere to the right of it is taken to be the same and so prepended to the partial URL to form the full URL. Otherwise:
The last part of the path of the context URI (anything following the rightmost slash) is removed, and the given partial URI appended in its place, and then:
Within the result, all occurrences of "xxx/../" or "/." [这里大概是”./”]Are recursively removed, where xxx, ".." and "." are complete path elements.