cURL / Mailing Lists / curl-library / Single Mail


Re: SFTP ideas and questions

From: Dan Fandrich <>
Date: Thu, 8 Dec 2011 00:15:41 -0800

On Wed, Dec 07, 2011 at 02:01:37PM +0100, Ellié Computing Open Source Program wrote:
> I am working on a SFTP client based on libcurl, and am confronted to a few
> problems, I have also some questions.
> 1. I cannot get better times than the minutes because of the listing, however I
> know the atime/mtime fields in LIBSSH2_SFTP_ATTRIBUTES are more precise than
> that, they are precise down to a second, and new versions of the protocol
> supports nanosecond. as you may infer from my email I work on a file comparison
> /synchronization tool and minute precision is somewhat too bad, in particular
> when we know better precision is reachable. could there be some raw mode for
> SFTP? or can I gain access to that data (I think about readdir_attrs content)?

sftp support in libcurl could probably use an extension like ftp has for
the CURLOPT_NOBODY option. libcurl in this case returns pseudo-HTTP headers
for the URL in question giving the size and date of the file. That
extension should work well to address this issue and provide all the
precision available.

> 2. during a listing, links are resolved, is it done in a round-trip friendly
> manner as SFTP allows it, or is there a full round-trip (I ask that because
> listing the /usr/bin folder takes ages here). as well why block the length of
> symbolic links at 80 bytes for the arrow+name, why not use MAX_PATH+4 ? it
> makes the result non trustable.

It performs a full round trip for each symbolic link. It doesn't seem
very wise to truncate the link length. I agree with you that it should be
increased to PATH_MAX.

> 3. it seems option CURLOPT_NEW_DIRECTORY_PERMS ignored when creating a
> directory (the 0755 flags are hardcoded in the case SSH_SFTP_QUOTE_MKDIR: while
> it is used in case SSH_SFTP_CREATE_DIRS_MKDIR:)

Looks like an oversight to me.

> (I can work on patches if you're ok)

That would be appreciated!

>>> Dan
List admin:
Received on 2011-12-08