transfer: init the infilesize from the postfields...

... with a strlen() if no size was set, and do this in the pretransfer
function so that the info is set early. Otherwise, the default strlen()
done on the POSTFIELDS data never sets state.infilesize.

Reported-by: Vincas Razma
Bug: #1294
This commit is contained in:
Daniel Stenberg 2017-05-30 00:45:54 +02:00
parent 35682764a9
commit e54db1b053
2 changed files with 7 additions and 9 deletions

View file

@ -1309,8 +1309,11 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
if(data->set.httpreq == HTTPREQ_PUT)
data->state.infilesize = data->set.filesize;
else
else {
data->state.infilesize = data->set.postfieldsize;
if(data->set.postfields && (data->state.infilesize == -1))
data->state.infilesize = (curl_off_t)strlen(data->set.postfields);
}
/* If there is a list of cookie files to read, do it now! */
if(data->change.cookielist)