summaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-05-30 00:45:54 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-05-30 11:39:42 +0200
commite54db1b053614ce5d332b5eea673ab370843e65b (patch)
tree2e5a0291ee958309a64cd5586263f7cac9eecc34 /lib/transfer.c
parent35682764a9dc7eb0fed3fbb1c0074f1c34dd60b2 (diff)
downloadcurl-e54db1b053614ce5d332b5eea673ab370843e65b.tar.gz
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
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c5
1 files changed, 4 insertions, 1 deletions
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)