cURL / Mailing Lists / curl-library / Single Mail


Abort FTP downloads

From: Christian Vogt <>
Date: Fri, 17 Aug 2007 11:43:05 +0200

Hi List,

I'm using libcurl for FTP and want to get some data and information
(like e.g. the file size and if the URL is correct, file/directory is
available, etc.) prior to downloading.

Therefore I thought I could start the transfer, call curl_easy_getinfo()
with CURLINFO_CONTENT_LENGTH_DOWNLOAD from the write callback, and
eventually abort it by returning 0 from the write callback once I got
all the info.

This works fine, but libcurl (most recent 7.16.4) drops the whole FTP
session and needs to re-login later when I abort the transfer this way.

Is there a way to abort the transfer without dropping the control

Are there other ways to validate a given FTP URL and to get the number
of bytes to download without actually starting the download? (avoiding
the need to abort the transfer)

Received on 2007-08-17