curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: how to reduce the number of TCP session generated by an FTP download using libcurl

From: Maurice Lemarin <curl_at_dm3c.org>
Date: Sat, 5 Nov 2016 21:01:57 +0100

Hi all,

I try to have libcurl reusing the same FTP control session but I fail
whatever the way I use it:
- using range (CURLOPT_RANGE)
- interrupting a transfer using the multi interface
- having the callback returning CURL_READFUNC_PAUSE

To be sure the problem was not in my C++ code I have made a very simple
C code which, if necessary, is available at
http://www.dm3c.org/curl/test-libcurl.tar.gz

Activating CURLOPT_VERBOSE while doing two consecutive range requests I
see the control session being closed after the first range request
(which succeeds), from the debug output it is visible that first, the
data session is closed and second the control session is also closed,
while only the data session should be closed:

> ABOR
< 150 0.001 seconds (measured here), 102.80 Mbytes per second
* partial download completed, closing connection
> QUIT
< 226 Since you see this ABOR must've succeeded
* Closing connection 0

Still if necessary, the full output is available here:
http://www.dm3c.org/curl/session.log.gz

Last, googling I have seen that some time ago for a different
need/problem, some FTP servers were in cause (including pure-ftpd, use
here). I have thus captured the networks exchanges and it shows the
control session is really closed due to a QUIT request (frame 29) from
client site (i.e: libcurl) just after the expected ABOR request (frame
27) from libcurl too. If necessary the full capture is available here:
http://www.dm3c.org/curl/libcurl-pure-ftpd.pcap.gz

Maybe I'm still doing something wrong, I'd be glad being advise how to
do it right in order to be able to read different parts of the same
remote file through a single FTP control session (and of course relying
on many data sessions).

Regards,
Maurice

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-11-05