Re: #295: Applying original fragment to "plain" redirected URI (also #43)

On 2011-12-30 18:51, Julian Reschke wrote:
> ...
> Indeed; see my tests at
> <http://greenbytes.de/tech/tc/httpredirects/#l-fragments> (note that
> Safari appears to have funny issues filling the iframes; but navigating
> to the linked resource gets you proper results).
> ...

I just realized that the rule we would need to describe *almost* is the 
one define in the URI spec 
(<http://greenbytes.de/tech/webdav/rfc3986.html#rfc.section.5.2>) as 
"relative resolution":

>    -- The URI reference is parsed into the five URI components
>    --
>    (R.scheme, R.authority, R.path, R.query, R.fragment) = parse(R);
>
>    -- A non-strict parser may ignore a scheme in the reference
>    -- if it is identical to the base URI's scheme.
>    --
>    if ((not strict) and (R.scheme == Base.scheme)) then
>       undefine(R.scheme);
>    endif;
>
>    if defined(R.scheme) then
>       T.scheme    = R.scheme;
>       T.authority = R.authority;
>       T.path      = remove_dot_segments(R.path);
>       T.query     = R.query;
>    else
>       if defined(R.authority) then
>          T.authority = R.authority;
>          T.path      = remove_dot_segments(R.path);
>          T.query     = R.query;
>       else
>          if (R.path == "") then
>             T.path = Base.path;
>             if defined(R.query) then
>                T.query = R.query;
>             else
>                T.query = Base.query;
>             endif;
>          else
>             if (R.path starts-with "/") then
>                T.path = remove_dot_segments(R.path);
>             else
>                T.path = merge(Base.path, R.path);
>                T.path = remove_dot_segments(T.path);
>             endif;
>             T.query = R.query;
>          endif;
>          T.authority = Base.authority;
>       endif;
>       T.scheme = Base.scheme;
>    endif;
>
>    T.fragment = R.fragment;

"Almost", because it doesn't use Base.fragment when R.frament is undefined.

a) Should we try describe the algorithm based on RFC 3986 ("do relative 
resolution as defined by ..., then, if the result doesn't have a 
fragment, add the one from the Base URI")?

b) Is this potentially an erratum for RFC 3986?

Best regards, Julian

Received on Tuesday, 3 January 2012 14:44:08 UTC