cURL / Mailing Lists / curl-library / Single Mail


Re: SFTP create missing directories

From: James Housley <>
Date: Tue, 12 Jun 2007 10:01:57 -0400

On Jun 12, 2007, at 4:45 AM, Daniel Stenberg wrote:

> Hi James,
> Since you're digging around in lib/ssh.c quite a lot right now, I
> thought that you might be the right person to have a look at Tom
> Regner's patch and possibly comment on how it fits with your
> remodeling of the code:
> (This is post 7.16.3, as I hope to do a release any day now)

Looking at the patch and some of the comments in that thread it
basically looks okay, but I would do it differently.

The FTP code walks each directory before upload and downloads, not as
efficient as a single change directory (but I understand why). So
following that precedent, I would like to do a libssh2_sftp_opendir()
to see if the directory exists. I believe that should give a
definitive answer about the existence of the destination directory.
If it doesn't exist, the call the sftp_create_dirs() routine. Then
try the libssh2_sftp_open() to start the upload.

How does that sound?

On a side note, the patch uses index() but isn't strchr() more widely


/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------     The Power to Serve
"Eagles may soar, but weasels don't get sucked into jet engines"
     -- Anon
Received on 2007-06-12