URI#path, windows, and file urls

Hi all,

Ruby 1.8.4
Windows XP

Is this correct?

require 'uri'
URI.parse("file:///C:/foo/bar").path # => "/C:/foo/bar"

The leading slash seems wrong to me, but then I'm not familiar with the
RFC's that cover such things.

Any insight appreciated.

Thanks,

Dan

I think the trick is that the file:// is the protocol, and the next / is
saying "absolute local path".

If you had no third slash.. file://myserver/share/dir will look for a host
"myserver". I guess if there wasn't a / before the c: then
file://c:/dirwould be looking for a host named "c:".

Of course there are more relaxed implementations than the RFC provides..

Cheers

;Daniel

···

On 18/04/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:

Hi all,

Ruby 1.8.4
Windows XP

Is this correct?

require 'uri'
URI.parse("file:///C:/foo/bar").path # => "/C:/foo/bar"

The leading slash seems wrong to me, but then I'm not familiar with the
RFC's that cover such things.

Any insight appreciated.

Thanks,

Dan

--
Daniel Baird
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog :: Things
That Suck)
[[My webhost uptime is ~ 92%.. if no answer pls call again later!]]

I think this is a case of Windows having multiple roots (A: , B: , C:, etc.) and URI obviously can't know a) I'm running on windows so b) C: is a root and not a directory named "C:". And it can't just guess because conceivably C: might be a directory on windows in some cases

···

On Apr 17, 2006, at 4:34 PM, Berger, Daniel wrote:

Hi all,

Ruby 1.8.4
Windows XP

Is this correct?

require 'uri'
URI.parse("file:///C:/foo/bar").path # => "/C:/foo/bar"

The leading slash seems wrong to me, but then I'm not familiar with the
RFC's that cover such things.

Any insight appreciated.

Thanks,

Dan