#619 Problem downloading 2 zero byte files with FTP

libcurl (356)


When downloading 2 zero byte files in a row, curl 7.16.0 enters an infinite loop, while curl 7.16.1-20061218 does one additional unnecessary request.

I tracked this problem to the variable headerbytecount being 0 in Curl_retry_request function. This used to be a number bigger than zero in curl-7.15.5 and older. Here is a simple program that will trigger this problem:

#include <curl/curl.h>
#include <curl/easy.h>

int main() {
CURLcode curl_res;
CURL* easy;

easy = curl_easy_init();
curl_easy_setopt(easy, CURLOPT_VERBOSE, 1);
curl_easy_setopt(easy, CURLOPT_URL, "ftp://ftp.sunet.se/pub/Linux/funet/sunsite_is_now_metalab_under_mirrors");

curl_res = curl_easy_perform(easy);

curl_res = curl_easy_perform(easy);

return 0;


  • Robson Braga Araujo

    Logged In: YES
    Originator: YES

    I attached a patch against 7.16.1-20061218 to fix this problem.

    During the "Major overhaul introducing http pipelining support and shared connection
    cache within the multi handle." change, headerbytecount was moved to live in the Curl_transfer_keeper structure. But that structure is reset in the Transfer method, losing the information that we had about the header size. This patch moves it back to the connectdata struct.
    File Added: curl-headerbytecount.patch

  • Daniel Stenberg

    Daniel Stenberg - 2006-12-21
    • status: open --> closed-fixed
  • Daniel Stenberg

    Daniel Stenberg - 2006-12-21

    Logged In: YES
    Originator: NO

    Thanks for your report and fix. It has now been applied and committed.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks