I modified code as below: if (attrs->flags & LIBSSH2_SFTP_ATTR_SIZE) { attrs->filesize = _libssh2_ntohu64(s); s += 8; } else { attrs->filesize = 6; //test file length } It can download file correctly. At 2014-10-10 10:57:04, <hudepeng2...@163.com> wrote: Found that, in libssh2\src\sftp.c function sftp_bin2attr(), the data do not have LIBSSH2_SFTP_ATTR_SIZE and LIBSSH2_SFTP_ATTR_UIDGID flags, but when listing files, it can get file size (have LIBSSH2_SFTP_ATTR_SIZE flag). Test with FileZilla client, maybe it also cannot get UID/GID (the UID and GID are "0"), but can dload file correctly. Why libssh2 cannot get file size when try to download files? At 2014-10-01 14:01:09, <hudepeng2...@163.com> wrote: use curl command "curl -u user:pwd -v -L sftp://sftp-ms.betagrid.gxs.com:22//TEST/readme.txt" and get logs : * Re-using existing connection! (#0) with host sftp-ms.betagrid.gxs.com * Connected to sftp-ms.betagrid.gxs.com (204.90.230.166) port 22 (#0) * File already completely downloaded * Connection died, retrying a fresh connect * Closing connection #0 * Issue another request to this URL: 'sftp://sftp-ms.betagrid.gxs.com:22//TEST/readme.txt' * About to connect() to sftp-ms.betagrid.gxs.com port 22 (#0) * Trying 204.90.230.166... * connected * Connected to sftp-ms.betagrid.gxs.com (204.90.230.166) port 22 (#0) * SSH authentication methods available: password,publickey * Using ssh public key file /home/test/.ssh/id_dsa.pub * Using ssh private key file /home/test/.ssh/id_dsa * SSH public key authentication failed: Unable to open public key file * Initialized password authentication * Authentication complete * File already completely downloaded * Connection #0 to host sftp-ms.betagrid.gxs.com left intact I know someone else get the similar issue, http://curl.haxx.se/mail/lib-2012-06/0156.html, Can get this file correctly by FileZilla client. Is there any update for this issue? Thanks! Depeng
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html