[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: w3m-expand-url (Re: w3m-anchor)

In the ML [emacs-w3m 01661] 
TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp> wrote:

土> (w3m-expand-url "http:file.html" "http://host/dir/")
土> --> "http://host/dir/file.html")

土> が、規格通りに扱えていないようです。

土> と指摘したのですが、RFC1808 の BNF 定義を参照すると、http:file.html と
土> いう書式が可能なのか、不可能なのか、よく分からなくなってしまいました。

それに関して、RFC 2396 "Uniform Resource Identifiers (URI): Generic Syntax"
の 5.2. Resolving Relative References to Absolute Form に次の様な説明が

   3) If the scheme component is defined, indicating that the reference
      starts with a scheme name, then the reference is interpreted as an
      absolute URI and we are done.  Otherwise, the reference URI's
      scheme is inherited from the base URI's scheme component.

      Due to a loophole in prior specifications [RFC1630], some parsers
      allow the scheme name to be present in a relative URI if it is the
      same as the base URI scheme.  Unfortunately, this can conflict
      with the correct parsing of non-hierarchical URI.  For backwards
      compatibility, an implementation may work around such references
      by removing the scheme if it matches that of the base URI and the
      scheme is known to always use the <hier_part> syntax.  The parser
      can then continue with the steps below for the remainder of the
      reference components.  Validating parsers should mark such a
      misformed relative reference as an error.