W3C home > Mailing lists > Public > ietf-http-wg@w3.org > January to March 2012

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

From: Julian Reschke <julian.reschke@gmx.de>
Date: Thu, 05 Jan 2012 21:31:39 +0100
Message-ID: <4F0608AB.20808@gmx.de>
To: Larry Masinter <masinter@adobe.com>
CC: Mark Nottingham <mnot@mnot.net>, httpbis Group <ietf-http-wg@w3.org>
On 2012-01-04 05:57, Larry Masinter wrote:
> ...
>
> "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?
>
> a) sounds good.
> b) I'd call it an "update" rather than an erratum.

OK, here's an attempt to describe this:

Appendix A.  Base Fragment Aware Relative Resolution

    Section 5.2 of [RFC3986] defines the Relative Resolution of a URI
    reference against a Base URI.  That algorithm however does not take a
    fragment identifier on the Base URI into account.

    However in some cases, as when following a redirect from a URI "Base"
    based on a Location header field containing the URI reference "R", it
    can be necessary to preserve a fragment identifier present on "Base".
    The algorithm described below does this:

    Given a URI reference "R" and a base URI "Base", to transform R into
    its target URI "T":

    (1) Pre-parse the Base URI as defined in Section 5.2.1 of [RFC3986].

    (2) Transform references as defined in Section 5.2.2 of [RFC3986].
    If the T.fragment is undefined and Base.fragment is defined, then set
    T.fragment to Base.fragment:

      if defined(Base.fragment) and not(defined(T.fragment)) then
        T.fragment = Base.fragment;
      endif;

    (3) Merge paths as defined in Section 5.2.3 of [RFC3986].

    (4) Remove dot segments as defined in Section 5.2.4 of [RFC3986].

    (5) Finally, recompose the components as defined in Section 5.3 of
    [RFC3986].

A.1.  Examples

    Starting with a Base URI of "http://host/path1#f1":

    +-----------+------------------------+------------------------------+
    | R         | T (after RFC 3986      | T (after Base Fragment Aware |
    |           | Relative Resolution)   | Relative Resolution)         |
    +-----------+------------------------+------------------------------+
    | /path2    | http://host/path2      | http://host/path2#f1         |
    | /path2#f2 | http://host/path2#f2   | http://host/path2#f2         |
    +-----------+------------------------+------------------------------+


(this could be an HTTPbis appendix or a standalone document if it's 
needed elsewhere)

Best regards, Julian
Received on Thursday, 5 January 2012 20:32:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 27 April 2012 06:51:52 GMT