mirror of
https://github.com/curl/curl.git
synced 2026-08-26 04:53:32 +03:00
multi: init_do(): check result
Calls to `Curl_init_do()` did not check on result and missed failures to properly and completely initialize a transfer request. The main cause of such an init failure is the need to rewind the READFUNCTION without a SEEKFUNCTION registered. Check the failure to "rewind" the upload data immediately make test cases 1576 and friends fail. Reported-by: Travis Lane Fixes #17139 Closes #17150
This commit is contained in:
parent
39f5e7cb69
commit
5e95556fc2
4 changed files with 33 additions and 17 deletions
|
|
@ -38,6 +38,15 @@ static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *stream)
|
|||
return strlen(testdata);
|
||||
}
|
||||
|
||||
static int seek_callback(void *ptr, curl_off_t offset, int origin)
|
||||
{
|
||||
(void)ptr;
|
||||
(void)offset;
|
||||
if(origin != SEEK_SET)
|
||||
return CURL_SEEKFUNC_FAIL;
|
||||
return CURL_SEEKFUNC_OK;
|
||||
}
|
||||
|
||||
CURLcode test(char *URL)
|
||||
{
|
||||
CURLcode res;
|
||||
|
|
@ -62,6 +71,7 @@ CURLcode test(char *URL)
|
|||
test_setopt(curl, CURLOPT_URL, URL);
|
||||
test_setopt(curl, CURLOPT_UPLOAD, 1L);
|
||||
test_setopt(curl, CURLOPT_READFUNCTION, read_callback);
|
||||
test_setopt(curl, CURLOPT_SEEKFUNCTION, seek_callback);
|
||||
test_setopt(curl, CURLOPT_INFILESIZE, (long)strlen(testdata));
|
||||
|
||||
test_setopt(curl, CURLOPT_CUSTOMREQUEST, "CURL");
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ my @reused_symbols = (
|
|||
"removeFd",
|
||||
"rlim2str",
|
||||
"run_thread",
|
||||
"seek_callback",
|
||||
"send_ping",
|
||||
"showem",
|
||||
"store_errmsg",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue