cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getting file from URI using file://

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 21 Feb 2002 08:33:31 +0100 (MET)

On Thu, 21 Feb 2002, Vishal_garg wrote:

> We are using curl-7.9.3 for client project to retrieve file from remore
> URI.. I am able to retrieve file using http:// and ftp:// protocols but it
> doesn't work for file://.

> However if the file to be retrieved is located on local machine then I am
> able to retrieve the file using file://.

... and that is when you should use the file:// protocol.

> For example suppose my machine's ip-address is 192.168.122.11 then
> file://192.168.122.11/Share/MyXML.xml works fine. But if I want to retrieve
> a file from location 192.168.122.208 at
> file://192.168.122.208/ipdr/MyXML.xml then libcurl fails to retrieve the
> file and returns '37' as error code.

That's because libcurl ignores whatever address or hostname you use when you
use file://. file:// is NOT an acknowledged way to get remote files. libcurl
only get files with file:// off the local filesystem (or what appears to be
the local file system).

(quoting RFC1738)

   The file URL scheme is unusual in that it does not specify an
   Internet protocol or access method for such files; as such, its
   utility in network protocols between hosts is limited.

If you feel differently, please let us know how libcurl could possibly access
a remote file using file://!

> However the same file at remote URI, I am able to retrieve through browser.

Well, you should sort that out with your browser vendor! ;-)

> Please suggest a solution.

Use HTTP or FTP.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-02-21