cURL / Mailing Lists / curl-library / Single Mail


Re: question of curl_easy_getinfo on sftp

From: Fabian Frank <>
Date: Sat, 18 Jan 2014 18:26:53 -0800

On Jan 16, 2014, at 8:53 AM, Daniel Stenberg <> wrote:
> Yeah, I can see how the state machine in lib/ssh.c stops too early if CURLOPT_NOBODY is set. Any chance you can see if you can fix this and send us a patch?

I was trying to find a contribution opportunity for the long weekend today and cam across this. YingWei, I hope you donít mind that I took a stab at fixing this.

For download, CURLOPT_NOBODY will now cause curl disconnect and stop after the stat phase, so curl now reports the correct CURLINFO_CONTENT_LENGTH_DOWNLOAD. For readdir the behavior of CURLOPT_NOBODY is unchanged.

Since the documentation for CURLINFO_CONTENT_LENGTH_DOWNLOAD says
> Since 7.19.4, this returns -1 if the size isn't known.
The patch is also setting CURLINFO_CONTENT_LENGTH_DOWNLOAD to -1 if either the stat call failed or a readdir was running, because the size is unknown in these cases.

Patch is attached and your feedback is greatly appreciated, Iíd be happy to send an updated patch incorporating it.


List admin:

Received on 2014-01-19