curl / Mailing Lists / curl-library / Single Mail

curl-library

SFTP File upload resume issue

From: sergio borghese <sergio.borghese_at_gmail.com>
Date: Sat, 17 Feb 2018 11:44:55 +0000

Hi,
I'm trying to develop a simple PoC (Proof of Concept) to perform an sftp
file upload that supports resume of partially transferred files.

Environemnt:
GNU/Linux Ubuntu 16.04 64b
libcurl 7.58.0 built with libssh2 support
gcc 5.4.0

I took the example: https://curl.haxx.se/libcurl/c/ftpuploadresume.html
and basically modified it to:
1. use the protocol string sftp
2. force resume branch (c=1) in the for() loop used to do the re-tries

The behavior I'm verifying is that once the connection is done:
1. the remote file size is truncated to zero
2. callback getcontentlengthfunc() is never called

I'm a bit confused by a comment as well:
/*
       * With NOBODY and NOHEADER, libcurl will issue a SIZE
       * command, but the only way to retrieve the result is
       * to parse the returned Content-Length header. Thus,
       * getcontentlengthfunc(). We need discardfunc() above
       * because HEADER will dump the headers to stdout
       * without it.
       */
      curl_easy_setopt(curlhandle, CURLOPT_NOBODY, 1L);
      curl_easy_setopt(curlhandle, CURLOPT_HEADER, 1L);

assuming the comment is correct, I would expect the option CURLOPT_HEADER
to be set to 0L instead.
I tried it as well but the behavior is the same described above.

Could you please give same advice on what I'm doing wrong?

Cheers
Sergio

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-02-17