cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: patch to make drive letters work in file:// urls under Window s

From: David Byron <DByron_at_everdreamcorp.com>
Date: Fri, 8 Aug 2003 09:07:06 -0700

On Thu, 7 Aug 2003, Daniel Stenberg wrote:
> curl used to support relative file:// urls until it was
> discovered that other tools (I believe it was lynx) don't use
> them that way.
>
> (If I'm not mistaking.)

After thinking about this and seeing other folks' results, I agree that we
shouldn't try to make paths relative to the current directory of curl work.

I think that leaves us with two kinds of paths that "should" work for
Windows:

a. paths relative to the root of the current drive
b. absolute paths that start with a drive letter and a colon (or pipe)

And one more that my testing below shows happens to work, but I haven't seen
discussed here:

c. paths relative to the current directory of a drive. See tests 9-12
below.

There seems to be more discussion about other parts of the URL as well.
Let's decide whether file: as opposed to file:// should work separately.
Same for handling spaces in paths.

The patch is attached. It's basically the one that Dan Fandrich sent.

Here are the tests I did with the patch applied. curl.exe is a native
Windows build and lives in C:\some\path. All from a cmd.exe window.

from C:\some\path
-----------------
1. file://test.txt -- found C:\some\path\test.txt
2. file://localhost/test.txt -- found C:\test.txt
3. file://localhost//test.txt -- found C:\test.txt
4. file:///test.txt -- found C:\test.txt

5. file://c:/test.txt -- found C:\test.txt
6. file://localhost/c:/test.txt -- found C:\test.txt
7. file://localhost//c:/test.txt -- found C:\test.txt
8. file:///c:/test.txt -- found C:\test.txt

9. file://c:test.txt -- found C:\some\path\test.txt
10. file://localhost/c:test.txt -- found C:\some\path\test.txt
11. file://localhost//c:test.txt -- found C:\some\path\test.txt
12. file:///c:test.txt -- found C:\some\path\test.txt

I consider all of the above to be correct, except maybe #1. But #1 isn't
affected by the patch, so let's discuss it later if we want to change it.

from Z:\ where the current directory on C: is still \some\path
--------------------------------------------------------------
1. file://test.txt -- found Z:\test.txt
2. file://localhost/test.txt -- found Z:\test.txt
3. file://localhost//test.txt -- found Z:\test.txt
4. file:///test.txt -- found Z:\test.txt

5. file://c:/test.txt -- found Z:\test.txt
6. file://localhost/c:/test.txt -- found C:\test.txt
7. file://localhost//c:/test.txt -- found C:\test.txt
8. file:///c:/test.txt -- found C:\test.txt

9. file://c:test.txt -- found C:\some\path\test.txt
10. file://localhost/c:test.txt -- found C:\some\path\test.txt
11. file://localhost//c:test.txt -- found C:\some\path\test.txt
12. file:///c:test.txt -- found C:\some\path\test.txt

I consider all of the above to be correct, except maybe #1, and maybe #5. I
believe making #5 work requires changing url.c with some Windows specific
code.

-DB

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

Received on 2003-08-08