From e54db1b053614ce5d332b5eea673ab370843e65b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 30 May 2017 00:45:54 +0200 Subject: 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 --- lib/transfer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/transfer.c') diff --git a/lib/transfer.c b/lib/transfer.c index 799fd4da8..43e8f64aa 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -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) -- cgit v1.2.3