curl: count uploaded data to stop at the originally given size

Closes #11223
Fixes #11222
Reported-by: JustAnotherArchivist on github
This commit is contained in:
Daniel Stenberg 2023-05-30 13:59:17 +02:00
parent 6661bd588d
commit 1f85420a28
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 33 additions and 38 deletions

View file

@ -327,8 +327,8 @@ static CURLcode pre_transfer(struct GlobalConfig *global,
#endif
my_setopt(per->curl, CURLOPT_INFILESIZE_LARGE, uploadfilesize);
}
per->input.fd = per->infd;
}
per->uploadfilesize = uploadfilesize;
per->start = tvnow();
return result;
}
@ -845,7 +845,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(state->up < state->infilenum) {
struct per_transfer *per = NULL;
struct OutStruct *outs;
struct InStruct *input;
struct OutStruct *heads;
struct OutStruct *etag_save;
struct HdrCbData *hdrcbdata = NULL;
@ -1004,7 +1003,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
hdrcbdata = &per->hdrcbdata;
outs = &per->outs;
input = &per->input;
per->outfile = NULL;
per->infdopen = FALSE;
@ -1274,9 +1272,6 @@ static CURLcode single_transfer(struct GlobalConfig *global,
/* what call to write */
my_setopt(curl, CURLOPT_WRITEFUNCTION, tool_write_cb);
/* for uploads */
input->config = config;
input->per = per;
/* Note that if CURLOPT_READFUNCTION is fread (the default), then
* lib/telnet.c will Curl_poll() on the input file descriptor
* rather than calling the READFUNCTION at regular intervals.
@ -1284,13 +1279,13 @@ static CURLcode single_transfer(struct GlobalConfig *global,
* behavior, by omitting to set the READFUNCTION & READDATA options,
* have not been determined.
*/
my_setopt(curl, CURLOPT_READDATA, input);
my_setopt(curl, CURLOPT_READDATA, per);
/* what call to read */
my_setopt(curl, CURLOPT_READFUNCTION, tool_read_cb);
/* in 7.18.0, the CURLOPT_SEEKFUNCTION/DATA pair is taking over what
CURLOPT_IOCTLFUNCTION/DATA pair previously provided for seeking */
my_setopt(curl, CURLOPT_SEEKDATA, input);
my_setopt(curl, CURLOPT_SEEKDATA, per);
my_setopt(curl, CURLOPT_SEEKFUNCTION, tool_seek_cb);
{