cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SFTP file info and state machine

From: John Utz <john_at_utzweb.net>
Date: Mon, 31 Jan 2011 18:32:01 -0500 (EST)

----- Original Message -----
> On Fri, 28 Jan 2011, John Utz wrote:
>
> > It seems to me that this job should be done only in the state
> >
> > "SSH_SFTP_QUOTE_STAT"
> >
> > instead of being spread between SSH_SFTP_QUOTE_STAT and
> > SSH_SCP_TRANS_INIT
>
> No, the QUOTE states are only used for quote commands and the
> SSH_SFTP_QUOTE_STAT in specific is only used of a stat-using quote
> command is
> used.

Thankyou for explaining that.
 
> When doing SFTP download, the libssh2_sftp_stat_ex() command is
> already used
> in the SSH_SFTP_DOWNLOAD_STAT state and I figure you should be able to
> set the
> information properly after that point.

if you are only checking fileinfo, you dont make it to SSH_SFTP_DOWNLOAD_STAT, you only make it to SSH_SFTP_TRANS_INIT. There are several edges inside of the SSH_SFTP_TRANS_INIT case statement and SSH_SFTP_DOWNLOAD_STAT is but one of them.

That explains why Sr. Mele chose to insert the code where he did. :-)

I agree that the use of libssh2_sftp_stat_ex() is a good(best?) choice getting the file data, but it would be gratuitously consumptive to call it twice in the download case.

Would it not be reasonable to add the libssh2_sftp_stat_ex() call to SSH_SFTP_TRANS_INIT and delete it from SSH_SFTP_DOWNLOAD_STAT?

commentary appreciated as always!

tnx!

johnu
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-01