Created
September 22, 2014 11:57
-
-
Save bagder/dd7a56d2bb76d99a12a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Trying to repeat bug report 1426 | |
https://sourceforge.net/p/curl/bugs/1426/ */ | |
#include <stdio.h> | |
#include <string.h> | |
/* somewhat unix-specific */ | |
#include <sys/time.h> | |
#include <unistd.h> | |
/* curl stuff */ | |
#include <curl/curl.h> | |
/* | |
* Simply download a HTTP file. | |
*/ | |
int main(int argc, char **argv) | |
{ | |
CURL *http_handle; | |
CURLM *multi_handle; | |
int still_running; /* keep number of running handles */ | |
if(argc < 2) { | |
printf("Usage: program [URL]\n"); | |
return 1; | |
} | |
curl_global_init(CURL_GLOBAL_DEFAULT); | |
http_handle = curl_easy_init(); | |
curl_easy_setopt(http_handle, CURLOPT_URL, argv[1]); | |
curl_easy_setopt(http_handle, CURLOPT_LOW_SPEED_LIMIT, 1L); | |
curl_easy_setopt(http_handle, CURLOPT_LOW_SPEED_TIME, 2L); | |
curl_easy_setopt(http_handle, CURLOPT_CONNECTTIMEOUT, 2L); | |
/* init a multi stack */ | |
multi_handle = curl_multi_init(); | |
/* add the individual transfers */ | |
curl_multi_add_handle(multi_handle, http_handle); | |
/* we start some action by calling perform right away */ | |
curl_multi_perform(multi_handle, &still_running); | |
do { | |
int msgs; | |
CURLMsg *m; | |
curl_multi_perform(multi_handle, &still_running); | |
m = curl_multi_info_read(multi_handle, &msgs); | |
if(m) { | |
fprintf(stderr, "RETURNED %d\n", m->data.result); | |
break; | |
} | |
} while(still_running); | |
curl_multi_remove_handle(multi_handle, http_handle); | |
curl_easy_cleanup(http_handle); | |
curl_multi_cleanup(multi_handle); | |
curl_global_cleanup(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are setting a whole lot other options additionally: https://github.com/xbmc/xbmc/blob/master/xbmc/filesystem/CurlFile.cpp#L429
The Arch user, that reported this bug was told to gather additional logfiles with more curl debugging output which can be enabled within xbmc. I hope he will add those to the original bugreport so that it gets easier to find the issue.
Thanks very much to find that regression.