Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Does support for FTP growing files work in libcurl?
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Robert Sumner via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 13 Oct 2022 18:59:38 +0100
I have been trying to get libcurl FTP to work to a tailmode supporting FTP
server with a growing file, but have not managed to get the full file back.
To try to enable this I set the curl option:
curl_easy_setopt(m_curlHandle, CURLOPT_IGNORE_CONTENT_LENGTH, 1L)
However, the code still just downloads the amount of file that was present
at the point the RETR command was issued, rather than the file's final size.
I'm not sure if this is something I'm doing wrong in the setup or if there
is an issue in the code.
Looking at the ftp.c code, I found that the CURLOPT_IGNORE_CONTENT_LENGTH
was taken and the set.ignorecl value set to true.
This is then used in ftp_state_quote() ftp.c line 1747, to not get the SIZE
of the file, but call RETR. This happens in my example.
The problem seems to come when ftp_state_get_resp() is called after this. At
this point the ftp->downloadsize is -1 (we didn't get it before because of
the set.ignorecl), but because of this, the code parses the response from
the RETR to try to get the file size form that. This works and it then sets
the size value in ftp->downloadsize. This causes the code to only retrieve
this amount of file rather than its final amount.
If I hack this, in the same way that the case for data->state.prefer_ascii
does, by explicitly setting the ftp->downloadsize = -1 (ftp.c line 2502).
Then the growing file works as expected and I get the full file back.
Am I missing something here or is it a problem?
Thanks for any help
Rob
Date: Thu, 13 Oct 2022 18:59:38 +0100
I have been trying to get libcurl FTP to work to a tailmode supporting FTP
server with a growing file, but have not managed to get the full file back.
To try to enable this I set the curl option:
curl_easy_setopt(m_curlHandle, CURLOPT_IGNORE_CONTENT_LENGTH, 1L)
However, the code still just downloads the amount of file that was present
at the point the RETR command was issued, rather than the file's final size.
I'm not sure if this is something I'm doing wrong in the setup or if there
is an issue in the code.
Looking at the ftp.c code, I found that the CURLOPT_IGNORE_CONTENT_LENGTH
was taken and the set.ignorecl value set to true.
This is then used in ftp_state_quote() ftp.c line 1747, to not get the SIZE
of the file, but call RETR. This happens in my example.
The problem seems to come when ftp_state_get_resp() is called after this. At
this point the ftp->downloadsize is -1 (we didn't get it before because of
the set.ignorecl), but because of this, the code parses the response from
the RETR to try to get the file size form that. This works and it then sets
the size value in ftp->downloadsize. This causes the code to only retrieve
this amount of file rather than its final amount.
If I hack this, in the same way that the case for data->state.prefer_ascii
does, by explicitly setting the ftp->downloadsize = -1 (ftp.c line 2502).
Then the growing file works as expected and I get the full file back.
Am I missing something here or is it a problem?
Thanks for any help
Rob
-- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2022-10-13