diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2007-01-30 23:19:21 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2007-01-30 23:19:21 +0000 |
commit | 8cf2e40daa778e71a384d4e7394c363b71d6fc63 (patch) | |
tree | 7645e036f7c8ba8b386692d5639dcd41901639e3 /render/form.c | |
parent | 5426a708a9010d04cf8baed45ce9909a09088ef6 (diff) | |
download | netsurf-8cf2e40daa778e71a384d4e7394c363b71d6fc63.tar.gz netsurf-8cf2e40daa778e71a384d4e7394c363b71d6fc63.tar.bz2 |
Bring handling of submission of blank file inputs in line with other browsers.
Tidy up fetch_post_convert while I'm at it.
svn path=/trunk/netsurf/; revision=3159
Diffstat (limited to 'render/form.c')
-rw-r--r-- | render/form.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/render/form.c b/render/form.c index 191985694..c646cab76 100644 --- a/render/form.c +++ b/render/form.c @@ -38,8 +38,8 @@ static char *form_acceptable_charset(struct form *form); * \return a new structure, or 0 on memory exhaustion */ -struct form *form_new(char *action, char *target, form_method method, char *charset, - char *doc_charset) +struct form *form_new(char *action, char *target, form_method method, + char *charset, char *doc_charset) { struct form *form; @@ -387,8 +387,14 @@ bool form_successful_controls(struct form *form, case GADGET_FILE: /* file */ - if (!control->value) - continue; + /* Handling of blank file entries is + * implementation defined - we're perfectly + * within our rights to treat it as an + * unsuccessful control. Unfortunately, every + * other browser submits the field with + * a blank filename and no content. So, + * that's what we have to do, too. + */ success_new = malloc(sizeof(*success_new)); if (!success_new) { LOG(("malloc failed")); @@ -396,7 +402,8 @@ bool form_successful_controls(struct form *form, } success_new->file = true; success_new->name = strdup(control->name); - success_new->value = strdup(control->value); + success_new->value = strdup(control->value ? + control->value : ""); success_new->next = 0; last_success->next = success_new; last_success = success_new; |