summaryrefslogtreecommitdiff
path: root/content/fetchers/curl.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-05-07 16:14:18 +0100
committerVincent Sanders <vince@kyllikki.org>2014-05-07 16:24:51 +0100
commitc56642819eed87431dff3446fe111f7f3eefaa7d (patch)
tree397126ca4baac425f9c1c44f3d5c56c681e2c4fe /content/fetchers/curl.c
parentc1e2da80dfa62793ea107cf12408c814e268a54b (diff)
downloadnetsurf-c56642819eed87431dff3446fe111f7f3eefaa7d.tar.gz
netsurf-c56642819eed87431dff3446fe111f7f3eefaa7d.tar.bz2
add file operations table and make all frontends use it.
This rationalises the path construction and basename file operations. The default implementation is POSIX which works for all frontends except windows, riscos and amiga which have differeing path separators and rules. These implementations are significantly more robust than the previous nine implementations and also do not use unsafe strncpy or buffers with arbitrary length limits. These implementations also carry full documentation comments.
Diffstat (limited to 'content/fetchers/curl.c')
-rw-r--r--content/fetchers/curl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 612b77d0b..80ac5ec89 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -50,6 +50,7 @@
#include "utils/utils.h"
#include "utils/ring.h"
#include "utils/useragent.h"
+#include "utils/file.h"
#include "content/fetch.h"
#include "content/fetchers/curl.h"
@@ -1280,15 +1281,15 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
{
struct curl_httppost *post = 0, *last = 0;
CURLFORMcode code;
+ nserror ret;
for (; control; control = control->next) {
if (control->file) {
- char *leafname = 0;
-
- leafname = guit->fetch->filename_from_path(control->value);
-
- if (leafname == NULL)
+ char *leafname = NULL;
+ ret = guit->file->basename(control->value, &leafname, NULL);
+ if (ret != NSERROR_OK) {
continue;
+ }
/* We have to special case filenames of "", so curl
* a) actually attempts the fetch and