cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: getting file from URI using file://

From: Andre Moll <amoll-mailer_at_libp.com>
Date: Fri, 22 Feb 2002 15:40:59 +0800

>> 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://.

I think the problem is, that under Win OS the file Protocoll can be used for
Access Samba Network shares.

So you cannot simply use HTTP or FTP.

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

This cannot be completely true. This only works with M$ Versions of Opera,
Netscape and IE. This behaviour is a very special Windows thingy. If u try
to make it this way, using the Unix/Linux Versions of the browsers, they
will fail also.

I am not sure, but I think for getting this behaviour under windows you have
to use Windows specific Classes like CFile or CStdIOFiles rather than the
Functions from the C Standardlibrary.

And if u want to have it under other OS too, then u must implement the samba
protocoll completely. Which I think isn't neccessary at all (unless a bored
programmer has nothing to do right now ;-) ).

However, I think if u want to have this behaviour for you, then u have no
choice then not to use cUrl for files and code this with M$ Classes.

Hope I am not wrong with this.

>
>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-22