cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: plain file

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 10 Nov 2003 10:39:12 +0100 (CET)

On Sun, 9 Nov 2003, Gisle Vanem wrote:

> I tried this by accident:
> curl -vO ftp://some-host/~
>
> It downloads okay producing a 1024 byte '~' file. I assume it's the content
> of the inode of the initial directory.

That is indeed a weird thing to do!

> UNIX Type: L8 Version: BSD-199506:
> SIZE ~
> 550 /home/**/giva: not a plain file.
> RETR ~
> 150 Opening BINARY mode data connection for '/home/**/giva'.

Since libcurl ignores all errors received from SIZE, this can proceed like
this.

> What's the normal definition of a "plain file". And how can I make curl skip
> non-plain files?

I would guess that the "not a plain file" message means that this accesses the
directory itself as a file, which I believe is possible on some systems.

One way to avoid this would probably be to treat error 550 from SIZE to be
important enough to error out on the current transfer. Servers that don't grok
SIZE return 500 I think (at least my old solaris one seems to do so).

> I dare not try to upload '~' afraid of wiping my ISP home-dir. What could
> happen?

I think that would be harmless. You will probably get a file created using
that name, which makes it a bit harder to access using command line tools due
to the name and some shells' habit of expanding ~ to your home directory.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
 [[ Do not post private mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
Received on 2003-11-10