From 29578a4fd851328186e4c394f61a18abcc00f681 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 7 Apr 2004 19:19:31 +0000 Subject: [project @ 2004-04-07 19:19:31 by jmb] Take account of file path when creating POST data. svn path=/import/netsurf/; revision=738 --- content/fetch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/content/fetch.c b/content/fetch.c index 78fd53812..d5bd31733 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -735,9 +735,9 @@ struct curl_httppost *fetch_post_convert(struct form_successful_control *control temp = control->value; /* already leafname */ else temp += 1; - leafname = malloc(strlen(temp)); + leafname = calloc(strlen(temp)+5, sizeof(char)); if (!leafname) { - LOG(("malloc failed")); + LOG(("calloc failed")); free(mimetype); continue; } @@ -751,7 +751,8 @@ struct curl_httppost *fetch_post_convert(struct form_successful_control *control #endif curl_formadd(&post, &last, CURLFORM_COPYNAME, control->name, - CURLFORM_FILE, leafname, + CURLFORM_FILE, control->value, + CURLFORM_FILENAME, leafname, CURLFORM_CONTENTTYPE, (mimetype != 0 ? mimetype : "text/plain"), CURLFORM_END); @@ -798,6 +799,7 @@ bool fetch_can_fetch(const char *url) if (strlen(data->protocols[i]) == len && strncasecmp(url, data->protocols[i], len) == 0) return true; + return false; } -- cgit v1.2.3