summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2005-07-03 15:57:10 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2005-07-03 15:57:10 +0000
commit3805c219fb68660bd439278007b4fc31acd2a20f (patch)
treebde4d644211cb434b2963f10fe712dd6035b0cfb /render
parenteb6a570aa6de8e5cb4baebfd80a58326c07304d0 (diff)
downloadnetsurf-3805c219fb68660bd439278007b4fc31acd2a20f.tar.gz
netsurf-3805c219fb68660bd439278007b4fc31acd2a20f.tar.bz2
[project @ 2005-07-03 15:57:10 by jmb]
Handle forms with no action attribute svn path=/import/netsurf/; revision=1783
Diffstat (limited to 'render')
-rw-r--r--render/box_construct.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index 7197beebe..3b518dfd6 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -1682,13 +1682,24 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
bool box_form(BOX_SPECIAL_PARAMS)
{
- char *action, *method, *enctype, *charset;
+ char *xmlaction, *action, *method, *enctype, *charset;
form_method fmethod;
struct form *form;
- if (!(action = (char *) xmlGetProp(n, (const xmlChar *) "action")))
- /* the action attribute is required */
- return true;
+ if (!(xmlaction = (char *)
+ xmlGetProp(n, (const xmlChar *) "action"))) {
+ /* the action attribute is required, but many forms fail to
+ * specify it. In the case where it is _not_ specified,
+ * follow other browsers and make the form action the
+ * URI of the page the form is contained in. */
+ action = strdup("");
+ } else {
+ action = strdup(xmlaction);
+ xmlFree(xmlaction);
+ }
+
+ if (!action)
+ return false;
fmethod = method_GET;
if ((method = (char *) xmlGetProp(n, (const xmlChar *) "method"))) {
@@ -1711,7 +1722,7 @@ bool box_form(BOX_SPECIAL_PARAMS)
form = form_new(action, fmethod, charset,
content->data.html.encoding);
if (!form) {
- xmlFree(action);
+ free(action);
xmlFree(charset);
return false;
}