[Dillo-dev]Re: Patch: META http-equiv=refresh is BROKEN a little :( From: Nikita V. Borodikhin - 2002-07-31 07:30 I'm so sorry... Patch is broken a little (DRC_TOKEN_USE_META_REFRESH placed in pref.c instead of DRC_TOKEN_ALLOW_META_REFRESH)... Here is the correct patch: diff -pruN dillo.orig/dillorc dillo/dillorc --- dillo.orig/dillorc Thu May 30 17:21:08 2002 +++ dillo/dillorc Wed Jul 31 14:07:07 2002 @@ -15,6 +15,9 @@ geometry=640x550 # If you have a lot of memory and a slow CPU, use YES, otherwise use NO use_dicache=NO +# We do not allow http-equiv=refresh by default because it's not +# conform to official HTML 4.01 standard +allow_meta_refresh=NO #------------------------------------------------------------------------- # RENDERING SECTION diff -pruN dillo.orig/src/html.c dillo/src/html.c --- dillo.orig/src/html.c Mon Jul 1 10:13:37 2002 +++ dillo/src/html.c Wed Jul 31 14:10:52 2002 @@ -2512,15 +2512,74 @@ static void Html_tag_close_form(DilloHtm /* * Handle - * We do not support http-equiv=refresh because it's non standar, - * (the HTML 4.01 SPEC recommends explicitily to avoid it), and it - * can be easily abused! + * We disable http-equiv=refresh by default because it's non standard, + * (the HTML 4.01 SPEC recommends explicitily to avoid it), + * and it can be easily abused! */ static void Html_tag_open_meta(DilloHtml *html, char *tag, gint tagsize) { + const gchar *http_equiv; + const gchar *content; + const gchar *url_string; + DwPage *page; + DwStyle style_attrs, *link_style; + DilloUrl *url; + gint dummy; + + page = DW_PAGE(html->dw); + style_attrs = *(html->stack[html->stack_top].style); + /* only valid inside HEAD */ - if (html->InFlags & IN_HEAD) - return; + if (! (html->InFlags & IN_HEAD)) + DEBUG_HTML_MSG ("META tag is not inside HEAD\n"); + + if ((http_equiv = Html_get_attr(html, tag, tagsize, "http-equiv"))) + { + if ((strcasecmp (http_equiv, "refresh") == 0) && prefs.allow_meta_refresh + && (content = Html_get_attr(html, tag, tagsize, "content"))) + { + url_string = strstr (content, "URL="); + if (strlen (url_string) > 4) + url_string += 4; + else + url_string = NULL; + + if (url_string && (url = a_Url_new(url_string, + URL_STR_(html->linkblock->base_url), + 0, 0))) + { + a_Dw_page_add_text (page, g_strdup ("This page uses META-refresh to "), + html->stack[(html)->stack_top].style); + + if (a_Cache_url_read(url, &dummy)) /* visited frame */ + style_attrs.color = a_Dw_style_color_new + (html->linkblock->visited_color, html->bw->main_window->window); + else /* unvisited frame */ + style_attrs.color = a_Dw_style_color_new + (html->linkblock->link_color, html->bw->main_window->window); + + style_attrs.uline = TRUE; + style_attrs.link = Html_set_new_link(html, &url); + link_style = a_Dw_style_new (&style_attrs, + html->bw->main_window->window); + + a_Dw_page_add_text(page, g_strdup(url_string), link_style); + + a_Dw_style_unref(link_style); + } + else + { + a_Dw_page_add_text (page, g_strdup ("Strange META-refresh argument: "), + html->stack[(html)->stack_top].style); + a_Dw_page_add_text (page, g_strdup (content), + html->stack[(html)->stack_top].style); + } + + a_Dw_page_add_parbreak(page, 9, html->stack[(html)->stack_top].style); + } + } + + return; } /* diff -pruN dillo.orig/src/prefs.c dillo/src/prefs.c --- dillo.orig/src/prefs.c Thu Apr 11 12:37:35 2002 +++ dillo/src/prefs.c Wed Jul 31 13:43:44 2002 @@ -53,6 +53,7 @@ static const struct { { "limit_text_width", DRC_TOKEN_LIMIT_TEXT_WIDTH }, { "font_factor", DRC_TOKEN_FONT_FACTOR }, { "use_dicache", DRC_TOKEN_USE_DICACHE }, + { "allow_meta_refresh", DRC_TOKEN_ALLOW_META_REFRESH }, { "show_back", DRC_TOKEN_SHOW_BACK }, { "show_forw", DRC_TOKEN_SHOW_FORW }, { "show_home", DRC_TOKEN_SHOW_HOME }, @@ -178,6 +179,9 @@ static guint Prefs_parser(GScanner *scan case DRC_TOKEN_USE_DICACHE: prefs.use_dicache = (strcmp(scanner->value.v_string, "YES") == 0); break; + case DRC_TOKEN_ALLOW_META_REFRESH: + prefs.allow_meta_refresh = (strcmp(scanner->value.v_string, "YES") == 0); + break; case DRC_TOKEN_SHOW_BACK: prefs.show_back = (strcmp(scanner->value.v_string, "YES") == 0); break; @@ -339,6 +343,7 @@ void a_Prefs_init(void) prefs.limit_text_width = FALSE; prefs.font_factor = 1.0; prefs.use_dicache = FALSE; + prefs.allow_meta_refresh = FALSE; prefs.show_back=TRUE; prefs.show_forw=TRUE; prefs.show_home=TRUE; diff -pruN dillo.orig/src/prefs.h dillo/src/prefs.h --- dillo.orig/src/prefs.h Thu Apr 11 12:37:35 2002 +++ dillo/src/prefs.h Wed Jul 31 13:44:01 2002 @@ -43,6 +43,7 @@ typedef enum { DRC_TOKEN_SHOW_ALT, DRC_TOKEN_LIMIT_TEXT_WIDTH, DRC_TOKEN_USE_DICACHE, + DRC_TOKEN_ALLOW_META_REFRESH, DRC_TOKEN_SHOW_BACK, DRC_TOKEN_SHOW_FORW, DRC_TOKEN_SHOW_HOME, @@ -85,6 +86,7 @@ struct _DilloPrefs { gboolean limit_text_width; gdouble font_factor; gboolean use_dicache; + gboolean allow_meta_refresh; gboolean show_back; gboolean show_forw; gboolean show_home; [Dillo-dev]Patch: META http-equiv=refresh From: Nikita V. Borodikhin - 2002-07-31 07:16 Hello all Dillo users ! I thought that META http-equiv=refresh parameter in fully not standard but recently I found Web Design Group's page about META tag (see http://www.htmlhelp.com/reference/html40/head/meta.html). They wrote - * We do not support http-equiv=refresh because it's non standar, - * (the HTML 4.01 SPEC recommends explicitily to avoid it), and it - * can be easily abused! + * We disable http-equiv=refresh by default because it's non standard, + * (the HTML 4.01 SPEC recommends explicitily to avoid it), + * and it can be easily abused! */ static void Html_tag_open_meta(DilloHtml *html, char *tag, gint tagsize) { + const gchar *http_equiv; + const gchar *content; + const gchar *url_string; + DwPage *page; + DwStyle style_attrs, *link_style; + DilloUrl *url; + gint dummy; + + page = DW_PAGE(html->dw); + style_attrs = *(html->stack[html->stack_top].style); + /* only valid inside HEAD */ - if (html->InFlags & IN_HEAD) - return; + if (! (html->InFlags & IN_HEAD)) + DEBUG_HTML_MSG ("META tag is not inside HEAD\n"); + + if ((http_equiv = Html_get_attr(html, tag, tagsize, "http-equiv"))) + { + if ((strcasecmp (http_equiv, "refresh") == 0) && prefs.allow_meta_refresh + && (content = Html_get_attr(html, tag, tagsize, "content"))) + { + url_string = strstr (content, "URL="); + if (strlen (url_string) > 4) + url_string += 4; + else + url_string = NULL; + + if (url_string && (url = a_Url_new(url_string, + URL_STR_(html->linkblock->base_url), + 0, 0))) + { + a_Dw_page_add_text (page, g_strdup ("This page uses META-refresh to "), + html->stack[(html)->stack_top].style); + + if (a_Cache_url_read(url, &dummy)) /* visited frame */ + style_attrs.color = a_Dw_style_color_new + (html->linkblock->visited_color, html->bw->main_window->window); + else /* unvisited frame */ + style_attrs.color = a_Dw_style_color_new + (html->linkblock->link_color, html->bw->main_window->window); + + style_attrs.uline = TRUE; + style_attrs.link = Html_set_new_link(html, &url); + link_style = a_Dw_style_new (&style_attrs, + html->bw->main_window->window); + + a_Dw_page_add_text(page, g_strdup(url_string), link_style); + + a_Dw_style_unref(link_style); + } + else + { + a_Dw_page_add_text (page, g_strdup ("Strange META-refresh argument: "), + html->stack[(html)->stack_top].style); + a_Dw_page_add_text (page, g_strdup (content), + html->stack[(html)->stack_top].style); + } + + a_Dw_page_add_parbreak(page, 9, html->stack[(html)->stack_top].style); + } + } + + return; } /* diff -pruN dillo.orig/src/prefs.c dillo/src/prefs.c --- dillo.orig/src/prefs.c Thu Apr 11 12:37:35 2002 +++ dillo/src/prefs.c Wed Jul 31 13:43:44 2002 @@ -53,6 +53,7 @@ static const struct { { "limit_text_width", DRC_TOKEN_LIMIT_TEXT_WIDTH }, { "font_factor", DRC_TOKEN_FONT_FACTOR }, { "use_dicache", DRC_TOKEN_USE_DICACHE }, + { "allow_meta_refresh", DRC_TOKEN_USE_META_REFRESH }, { "show_back", DRC_TOKEN_SHOW_BACK }, { "show_forw", DRC_TOKEN_SHOW_FORW }, { "show_home", DRC_TOKEN_SHOW_HOME }, @@ -178,6 +179,9 @@ static guint Prefs_parser(GScanner *scan case DRC_TOKEN_USE_DICACHE: prefs.use_dicache = (strcmp(scanner->value.v_string, "YES") == 0); break; + case DRC_TOKEN_ALLOW_META_REFRESH: + prefs.allow_meta_refresh = (strcmp(scanner->value.v_string, "YES") == 0); + break; case DRC_TOKEN_SHOW_BACK: prefs.show_back = (strcmp(scanner->value.v_string, "YES") == 0); break; @@ -339,6 +343,7 @@ void a_Prefs_init(void) prefs.limit_text_width = FALSE; prefs.font_factor = 1.0; prefs.use_dicache = FALSE; + prefs.allow_meta_refresh = FALSE; prefs.show_back=TRUE; prefs.show_forw=TRUE; prefs.show_home=TRUE; diff -pruN dillo.orig/src/prefs.h dillo/src/prefs.h --- dillo.orig/src/prefs.h Thu Apr 11 12:37:35 2002 +++ dillo/src/prefs.h Wed Jul 31 13:44:01 2002 @@ -43,6 +43,7 @@ typedef enum { DRC_TOKEN_SHOW_ALT, DRC_TOKEN_LIMIT_TEXT_WIDTH, DRC_TOKEN_USE_DICACHE, + DRC_TOKEN_ALLOW_META_REFRESH, DRC_TOKEN_SHOW_BACK, DRC_TOKEN_SHOW_FORW, DRC_TOKEN_SHOW_HOME, @@ -85,6 +86,7 @@ struct _DilloPrefs { gboolean limit_text_width; gdouble font_factor; gboolean use_dicache; + gboolean allow_meta_refresh; gboolean show_back; gboolean show_forw; gboolean show_home; [Dillo-dev]Bug 254, Table width is too large. From: Matias Aguirre - 2002-07-31 07:16 Hi list, Im new to dillo and you maked a great work. In 254 bug describes "table width is too large" but this is not the reason of this bug. The reason is that if you read the source of http://linux.oreillynet.com/pub/a/linux/2001/11/15/learnunixos.html you found