Fri Apr 16 00:47:39 CEST 2010 Dmitry Kurochkin * Fix hscurl.c when URL is downloaded during the first call to curl_multi_perform. Turns out that the first call to curl_multi_perform() can fetch the URL or result in error. I can easily reproduce this using HTTP server on localhost. This means that situation when running_handles is zero is valid, so remove the error and handle it correctly. diff -rN -u old-darcs.net/src/hscurl.c new-darcs.net/src/hscurl.c --- old-darcs.net/src/hscurl.c 2010-06-28 19:35:56.382397912 +0200 +++ new-darcs.net/src/hscurl.c 2010-06-28 19:35:57.544398155 +0200 @@ -19,7 +19,6 @@ RESULT_MULTI_INIT_FAIL, RESULT_EASY_INIT_FAIL, RESULT_SLIST_APPEND_FAIL, - RESULT_NO_RUNNING_HANDLES, RESULT_MULTI_INFO_READ_FAIL, RESULT_UNKNOWN_MESSAGE, RESULT_FILE_OPEN_FAIL @@ -33,7 +32,6 @@ "curl_multi_init() failed", "curl_easy_init() failed", "curl_slist_append() failed", - "curl_multi_perform() - no running handles", "curl_multi_info_read() failed", "curl_multi_info_read() returned unknown message", "fopen() failed" @@ -67,11 +65,9 @@ error = curl_multi_perform(multi, &running_handles); if (error != CURLM_OK && error != CURLM_CALL_MULTI_PERFORM) return curl_multi_strerror(error); - if (running_handles == 0) - return error_strings[RESULT_NO_RUNNING_HANDLES]; running_handles_last = running_handles; - while (1) + while (running_handles_last > 0) { while (error == CURLM_CALL_MULTI_PERFORM) error = curl_multi_perform(multi, &running_handles);