#619 Problem downloading 2 zero byte files with FTP

closed-fixed
libcurl (356)
5
2013-06-21
2006-12-18
No

Hi,

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;

curl_global_init(CURL_GLOBAL_ALL);
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;
}

Discussion

  • Logged In: YES
    user_id=307089
    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

     
  • Patch to fix headerbytecount being reset

     
    • status: open --> closed-fixed
     
  • Logged In: YES
    user_id=1110
    Originator: NO

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