curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Curl closing connection in case of incomplete transfer

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 8 Aug 2018 18:57:11 +0200 (CEST)

On Wed, 8 Aug 2018, Antoine Magaud via curl-library wrote:

> 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.

That version is 3.5 years old and has no less than 42 known vulnerabilities!

> 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?

It is exactly because of that, and there's nothing you can do to stop it other
than reading the full file! :-/

The reason is that just reading a part of the file and then stopping, leaves
the control channel in a state that cannot easily be used again without weird
behaviors or hangs. The exact behaviors will also depend on the specific FTP
server implementations.

So, libcurl does this to take the safe route.

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