how to convert //foo/bar to URI? - Unix

This is a discussion on how to convert //foo/bar to URI? - Unix ; If I understand correctly, SUSv3 says that the meaning of a pathname is implementation-defined if it begins with exactly two slashes. Which operating systems use such pathnames? Is there a customary way of representing such pathnames in URIs? For example, ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: how to convert //foo/bar to URI?

  1. how to convert //foo/bar to URI?

    If I understand correctly, SUSv3 says that the meaning of a
    pathname is implementation-defined if it begins with exactly two
    slashes. Which operating systems use such pathnames?
    Is there a customary way of representing such pathnames in URIs?
    For example, would //foo/dir/file.html be translated to:

    (a) file://localhost//foo/dir/file.html
    (b) file://localhost/%2Ffoo/dir/file.html
    (c) file://localhost/%2Ffoo%2Fdir%2Ffile.html

    The choice of course affects how a ".." reference in file.html
    would be handled. So, it should preferably correspond to how the
    operating system treats such references. E.g. whether
    //foo/../bar means /bar or //bar or something entirely different.

    In ELinks, a test related to this is failing, and I'd like to
    know what the correct behaviour is before I go tweak the code
    again.

  2. Re: how to convert //foo/bar to URI?

    Kalle Olavi Niemitalo writes:

    > If I understand correctly, SUSv3 says that the meaning of a
    > pathname is implementation-defined if it begins with exactly two
    > slashes. Which operating systems use such pathnames?


    Microsoft Windows, possibly others.

    > Is there a customary way of representing such pathnames in URIs?
    > For example, would //foo/dir/file.html be translated to:
    >
    > (a) file://localhost//foo/dir/file.html
    > (b) file://localhost/%2Ffoo/dir/file.html
    > (c) file://localhost/%2Ffoo%2Fdir%2Ffile.html
    >
    > The choice of course affects how a ".." reference in file.html
    > would be handled. So, it should preferably correspond to how the
    > operating system treats such references. E.g. whether
    > //foo/../bar means /bar or //bar or something entirely different.
    >
    > In ELinks, a test related to this is failing, and I'd like to
    > know what the correct behaviour is before I go tweak the code
    > again.


    Since the meaning of // is implementation-defined, there cannot be a
    single correct behaviour.

    --
    Måns Rullgård
    mans@mansr.com

  3. Re: how to convert //foo/bar to URI?

    In article ,
    Måns Rullgård wrote:

    > Kalle Olavi Niemitalo writes:
    >
    > > If I understand correctly, SUSv3 says that the meaning of a
    > > pathname is implementation-defined if it begins with exactly two
    > > slashes. Which operating systems use such pathnames?

    >
    > Microsoft Windows, possibly others.


    I vaguely recall some early network filesystem implementations that used
    this, something like //servername/path/to/file. Maybe this was on
    Apollo workstations?

    >
    > > Is there a customary way of representing such pathnames in URIs?
    > > For example, would //foo/dir/file.html be translated to:
    > >
    > > (a) file://localhost//foo/dir/file.html
    > > (b) file://localhost/%2Ffoo/dir/file.html
    > > (c) file://localhost/%2Ffoo%2Fdir%2Ffile.html
    > >
    > > The choice of course affects how a ".." reference in file.html
    > > would be handled. So, it should preferably correspond to how the
    > > operating system treats such references. E.g. whether
    > > //foo/../bar means /bar or //bar or something entirely different.
    > >
    > > In ELinks, a test related to this is failing, and I'd like to
    > > know what the correct behaviour is before I go tweak the code
    > > again.

    >
    > Since the meaning of // is implementation-defined, there cannot be a
    > single correct behaviour.


    Sure there can. He's just asking about a syntactic transformation from
    URL to pathname, regardless of how the pathname will be interpreted by
    the OS. This should be specified in the description of the file: URL
    scheme.

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE don't copy me on replies, I'll read them in the group ***

  4. Re: how to convert //foo/bar to URI?

    Barry Margolin writes:

    > In article ,
    > Måns Rullgård wrote:
    >
    >> Kalle Olavi Niemitalo writes:
    >>
    >> > If I understand correctly, SUSv3 says that the meaning of a
    >> > pathname is implementation-defined if it begins with exactly two
    >> > slashes. Which operating systems use such pathnames?

    >>
    >> Microsoft Windows, possibly others.

    >
    > I vaguely recall some early network filesystem implementations that used
    > this, something like //servername/path/to/file. Maybe this was on
    > Apollo workstations?
    >
    >>
    >> > Is there a customary way of representing such pathnames in URIs?
    >> > For example, would //foo/dir/file.html be translated to:
    >> >
    >> > (a) file://localhost//foo/dir/file.html
    >> > (b) file://localhost/%2Ffoo/dir/file.html
    >> > (c) file://localhost/%2Ffoo%2Fdir%2Ffile.html
    >> >
    >> > The choice of course affects how a ".." reference in file.html
    >> > would be handled. So, it should preferably correspond to how the
    >> > operating system treats such references. E.g. whether
    >> > //foo/../bar means /bar or //bar or something entirely different.
    >> >
    >> > In ELinks, a test related to this is failing, and I'd like to
    >> > know what the correct behaviour is before I go tweak the code
    >> > again.

    >>
    >> Since the meaning of // is implementation-defined, there cannot be a
    >> single correct behaviour.

    >
    > Sure there can. He's just asking about a syntactic transformation from
    > URL to pathname, regardless of how the pathname will be interpreted by
    > the OS. This should be specified in the description of the file: URL
    > scheme.


    What if the implementation-defined meaning of // is for //foo/bar/baz
    to be equivalent to http://foo/bar/baz, or anything else that cannot
    be represented by a file: URL?

    --
    Måns Rullgård
    mans@mansr.com

  5. Re: how to convert //foo/bar to URI?

    Måns Rullgård writes:

    > Since the meaning of // is implementation-defined, there cannot be a
    > single correct behaviour.


    I can implement different filename-to-URI mappings on different
    operating systems if I know the local semantics and how to detect
    the operating systems at configure or run time. My intention is
    that relative URI-references would behave the same as relative
    pathnames.

    So far, Windows and Apollo workstations have been mentioned.
    On those, do pathnames in the "//" namespace use "/" as a
    directory separator and ".." to mean the parent directory?
    Is "//foo/.." the same as "//" and "//.." the same as "/"?
    Is there any syntax that would make "/" not have its usual
    meaning? (E.g. "@" in "//versioned/dir/file@03/13/2008".)

+ Reply to Thread