summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fb-helper.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/fb-helper.c b/fb-helper.c
index 5a429b2..c8e4256 100644
--- a/fb-helper.c
+++ b/fb-helper.c
@@ -233,7 +233,6 @@ int main(int argc, char *argv[])
struct curl_httppost *lastptr = NULL;
struct curl_slist *headerlist = NULL;
static const char buf[] = "Expect:";
- struct curl_forms forms[4];
char *userAgent = "fb-client/"VERSION;
@@ -324,27 +323,23 @@ int main(int argc, char *argv[])
goto cleanup;
}
- forms[0].option = CURLFORM_BUFFER;
- forms[0].value = basename(options.file);
- forms[1].option = CURLFORM_BUFFERPTR;
- forms[1].value = data;
- forms[2].option = CURLFORM_BUFFERLENGTH;
- forms[2].value = (char *)data_size;
- forms[3].option = CURLFORM_END;
+ /* Fill in the file upload field */
+ curl_formadd(&formpost,
+ &lastptr,
+ CURLFORM_COPYNAME, "file",
+ CURLFORM_BUFFER, basename(options.file),
+ CURLFORM_BUFFERPTR, data,
+ CURLFORM_BUFFERLENGTH, (char *)data_size,
+ CURLFORM_END);
} else {
- forms[0].option = CURLFORM_FILE;
- forms[0].value = options.file;
- forms[1].option = CURLFORM_END;
+ /* Fill in the file upload field */
+ curl_formadd(&formpost,
+ &lastptr,
+ CURLFORM_COPYNAME, "file",
+ CURLFORM_FILE, options.file,
+ CURLFORM_END);
}
- /* Fill in the file upload field */
- curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "file",
- CURLFORM_ARRAY, forms,
- CURLFORM_END);
- curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
-
if (isatty(fileno(stderr)) == 1) {
/* display progress bar*/
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
@@ -353,6 +348,8 @@ int main(int argc, char *argv[])
}
}
+ curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
+
/* initialize custom header list (stating that Expect: 100-continue is not
wanted */
headerlist = curl_slist_append(headerlist, buf);