aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Henty <onepoint@starurchin.org>2011-03-31 19:02:37 +0100
committerJeremy Henty <onepoint@starurchin.org>2011-03-31 19:02:37 +0100
commitfe88f02971ffe5dd093941032a630fa70445b794 (patch)
tree12dc02389ccbe772b196583db45a24f715c543af
parentfafbb982bdaec722f49d6c5034f936ce4a8f9188 (diff)
html.cc: Html_tag_open_meta(): check that the URL exists before redirecting.
-rw-r--r--src/html.cc67
1 files changed, 35 insertions, 32 deletions
diff --git a/src/html.cc b/src/html.cc
index 3e44e26e..254ca04d 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -2866,41 +2866,44 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize)
}
/* Skip to anything after "URL=" */
while (*content && *(content++) != '=') ;
- /* Handle the case of a quoted URL */
- if (*content == '"' || *content == '\'') {
- if ((p = strchr(content + 1, *content)))
- mr_url = dStrndup(content + 1, p - content - 1);
- else
- mr_url = dStrdup(content + 1);
- } else {
- mr_url = dStrdup(content);
- }
+ if (*content) {
- if (delay == 0) {
- /* zero-delay redirection */
- html->stop_parser = true;
- DilloUrl *new_url = a_Url_new(mr_url, URL_STR(html->base_url));
- if (a_Capi_dpi_verify_request(html->bw, new_url))
- a_UIcmd_redirection0((void*)html->bw, new_url);
- a_Url_free(new_url);
- } else {
- /* Send a custom HTML message.
- * TODO: This is a hairy hack,
- * It'd be much better to build a widget. */
- Dstr *ds_msg = dStr_sized_new(256);
- dStr_sprintf(ds_msg, meta_template, mr_url, delay_str);
- {
- int o_InFlags = html->InFlags;
- int o_TagSoup = html->TagSoup;
- html->InFlags = IN_BODY;
- html->TagSoup = false;
- Html_write_raw(html, ds_msg->str, ds_msg->len, 0);
- html->TagSoup = o_TagSoup;
- html->InFlags = o_InFlags;
+ /* Handle the case of a quoted URL */
+ if (*content == '"' || *content == '\'') {
+ if ((p = strchr(content + 1, *content)))
+ mr_url = dStrndup(content + 1, p - content - 1);
+ else
+ mr_url = dStrdup(content + 1);
+ } else {
+ mr_url = dStrdup(content);
+ }
+
+ if (delay == 0) {
+ /* zero-delay redirection */
+ html->stop_parser = true;
+ DilloUrl *new_url = a_Url_new(mr_url, URL_STR(html->base_url));
+ if (a_Capi_dpi_verify_request(html->bw, new_url))
+ a_UIcmd_redirection0((void*)html->bw, new_url);
+ a_Url_free(new_url);
+ } else {
+ /* Send a custom HTML message.
+ * TODO: This is a hairy hack,
+ * It'd be much better to build a widget. */
+ Dstr *ds_msg = dStr_sized_new(256);
+ dStr_sprintf(ds_msg, meta_template, mr_url, delay_str);
+ {
+ int o_InFlags = html->InFlags;
+ int o_TagSoup = html->TagSoup;
+ html->InFlags = IN_BODY;
+ html->TagSoup = false;
+ Html_write_raw(html, ds_msg->str, ds_msg->len, 0);
+ html->TagSoup = o_TagSoup;
+ html->InFlags = o_InFlags;
+ }
+ dStr_free(ds_msg, 1);
}
- dStr_free(ds_msg, 1);
+ dFree(mr_url);
}
- dFree(mr_url);
} else if (!dStrcasecmp(equiv, "content-type") &&
(content = a_Html_get_attr(html, tag, tagsize, "content"))) {