curl / Mailing Lists / curl-library / Single Mail


Curl closing connection in case of incomplete transfer

From: Antoine Magaud via curl-library <>
Date: Wed, 8 Aug 2018 16:55:35 +0100

I'm kinda new to using libcurl, and am facing an issue which I can't
around. I am using curl version 7.41.0.
The scenario is the following: I want to read a file on an FTP server
(partially, only the first few MB of the file), and then keep the
connection open to read another file in the same folder. To do that I am
using a multi handle, to which I add an easy handle, and perform requests
on the multi handle. After I've read enough I remove the easy from the
multi, and at that time I get a "Closing connection 0" message. I am sure
it is related to not reading the whole file, because I did more tests with
small files (less than the size I want to read), and in that case the
connection is not closed, I get the message CURLMSG_DONEand can re-use the
existing connection as many times as I want.
I'm probably missing something here, I would expect the connection to stay
open even if I don't read the whole file. Do I need to do something
specific for the connection not to be closed?

Thanks in advance for the help!

Received on 2018-08-08