Issue with FTP and PRETRANSFER_TIME
Date: Tue, 29 Mar 2016 13:17:43 -0700
I am using libcurl for doing FTP RETR requests and have an issue with the
I expected this time to be the time until Curl sends the RETR command, as
the documentation is stating the following for this time:
"time, in seconds, it took from the start until the file transfer is just
about to begin. This includes all pre-transfer commands and negotiations
that are specific to the particular protocol(s) involved. It does not
involve the sending of the protocol- specific request that triggers a
Although it seems that Curl is actually meausuring the time until the
server's response to the RETR command is received. In order to understand
this behavior I used some of the debug options and got the following output:
1.62899 => Send header, 0000000024 bytes (0x00000018)
0000: SIZE someFileName
1.79143 <= Recv header, 0000000011 bytes (0x0000000b)
0000: 213 80000
1.79148 => Send header, 0000000024 bytes (0x00000018)
0000: RETR someFileName
1.95394 <= Recv header, 0000000054 bytes (0x00000036)
0000: 125 Data connection already open; Transfer starting.
1.95548 <= Recv data, 0000000000 bytes (0x00000000)
The floats at the beginning of the lines are the elapsed time in seconds
since the start of the transaction.
In this case the time information Curl gave me are as follows:
As you can see, the CURLINFO_PRETRANSFER_TIME is apparently the time when
the server's "125" response was received and not the time the RETR was
send, which was 1.79148.
CURLINFO_STARTTRANSFER_TIME is the time it took until the first payload
bytes were received by Curl, which seems to be fine.
I am not sure if this is the intended behavior? If so, I think it's
violating the definition in the documentation as the transfer is just about
to begin when the RETR command is issued. Right now this time is actually
including "sending of the protocol- specific request that triggers a
transfer", although the definition states that it shouldn't.
Furthermore the timings are not very helpful the way they are now as
CURLINFO_PRETRANSFER_TIME and CURLINFO_STARTTRANSFER_TIME should be usually
extremely close in the current implementation.
I attached example code, which can be used to produce these measurements.
Just pass the URL (including credentials) as the command line argument,
I used the current master of Curl's git repo.
List admin: https://cool.haxx.se/list/listinfo/curl-library
- text/x-c++src attachment: CurlPreTransferExample.cpp