From 46acf7be5791a164f8fa5dbc16494d8175e5b850 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 14 Nov 2014 15:08:02 +0000 Subject: [PATCH] Ignore SGML style tags in html. --- src/libserver/html.c | 6 +++++- src/libserver/html.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libserver/html.c b/src/libserver/html.c index fdb6a11db..edf831238 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -493,6 +493,10 @@ construct_html_node (rspamd_mempool_t * pool, gchar *text, gsize tag_len) html->flags |= FL_XML; html->tag = NULL; } + else if (*text == '!') { + html->flags |= FL_SGML; + html->tag = NULL; + } else { if (*text == '/') { html->flags |= FL_CLOSING; @@ -972,7 +976,7 @@ add_html_node (struct rspamd_task *task, part->is_balanced = FALSE; } } - else { + else if ((data->flags & (FL_XML|FL_SGML)) == 0) { g_node_append (*cur_level, new); if ((data->flags & FL_CLOSED) == 0) { diff --git a/src/libserver/html.h b/src/libserver/html.h index 6709ed151..1760ad0ca 100644 --- a/src/libserver/html.h +++ b/src/libserver/html.h @@ -192,6 +192,8 @@ typedef enum #define FL_CLOSING (1 << 1) /* Fully closed tag (e.g. ) */ #define FL_CLOSED (1 << 2) +/*