summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-07-03 21:41:25 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-07-03 21:41:25 +0000
commit5e2567370d9be341a18203a5df9206ebe32e1fb9 (patch)
tree859cb4d4fc737d97110d1b0a2ca860d3638c7750 /render
parentde0c4e2c32c1ecbef75293653adff4e4ceffeffe (diff)
downloadnetsurf-5e2567370d9be341a18203a5df9206ebe32e1fb9.tar.gz
netsurf-5e2567370d9be341a18203a5df9206ebe32e1fb9.tar.bz2
Fix submission of forms in embedded objects; resolve submission URL at
form creation time rather than at submit. svn path=/trunk/netsurf/; revision=2707
Diffstat (limited to 'render')
-rw-r--r--render/box_construct.c24
-rw-r--r--render/form.h2
2 files changed, 18 insertions, 8 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index a5f654926..252af0d19 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -306,13 +306,13 @@ bool box_construct_element(xmlNode *n, struct content *content,
assert(inline_container);
gui_multitask();
-
+
/* In case the parent is a pre block, we clear the
* strip_leading_newline flag since it is not used if we
* follow the pre with a tag
*/
parent->strip_leading_newline = 0;
-
+
style = box_get_style(content, parent_style, n);
if (!style)
return false;
@@ -663,7 +663,7 @@ bool box_construct_text(xmlNode *n, struct content *content,
box_text_transform(text, strlen(text),
parent_style->text_transform);
current = text;
-
+
/* swallow a single leading new line */
if (parent->strip_leading_newline) {
switch (*current) {
@@ -676,7 +676,7 @@ bool box_construct_text(xmlNode *n, struct content *content,
}
parent->strip_leading_newline = 0;
}
-
+
do {
size_t len = strcspn(current, "\r\n");
char old = current[len];
@@ -1781,9 +1781,10 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
bool box_form(BOX_SPECIAL_PARAMS)
{
- char *xmlaction, *action, *method, *enctype, *charset;
+ char *xmlaction, *action, *faction, *method, *enctype, *charset;
form_method fmethod;
struct form *form;
+ url_func_result result;
if (!(xmlaction = (char *)
xmlGetProp(n, (const xmlChar *) "action"))) {
@@ -1800,6 +1801,15 @@ bool box_form(BOX_SPECIAL_PARAMS)
if (!action)
return false;
+ result = url_join(action, content->data.html.base_url, &faction);
+ if (result != URL_FUNC_OK) {
+ free(action);
+ return false;
+ }
+
+ /* No longer needed */
+ free(action);
+
fmethod = method_GET;
if ((method = (char *) xmlGetProp(n, (const xmlChar *) "method"))) {
if (strcasecmp(method, "post") == 0) {
@@ -1818,10 +1828,10 @@ bool box_form(BOX_SPECIAL_PARAMS)
/* acceptable encoding(s) for form data */
charset = (char *) xmlGetProp(n, (const xmlChar *) "accept-charset");
- form = form_new(action, fmethod, charset,
+ form = form_new(faction, fmethod, charset,
content->data.html.encoding);
if (!form) {
- free(action);
+ free(faction);
xmlFree(charset);
return false;
}
diff --git a/render/form.h b/render/form.h
index 48630dea2..cf9a0e746 100644
--- a/render/form.h
+++ b/render/form.h
@@ -29,7 +29,7 @@ typedef enum {
/** HTML form. */
struct form {
- char *action; /**< URL to submit to. */
+ char *action; /**< Absolute URL to submit to. */
form_method method; /**< Method and enctype. */
char *accept_charsets; /**< Charset to submit form in */
char *document_charset; /**< Charset of document containing form */