diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-11-01 15:30:14 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-11-01 15:30:14 +0000 |
commit | 7a820f15c13ead1dc2675c42296bcf80bb424098 (patch) | |
tree | a1b969d111d6bcab6f7d0169b7338e673f446358 /src/libserver/html.c | |
parent | a144260321074948e012e621020515dbf448f85a (diff) | |
download | rspamd-7a820f15c13ead1dc2675c42296bcf80bb424098.tar.gz rspamd-7a820f15c13ead1dc2675c42296bcf80bb424098.zip |
[Feature] Track visibility of HTML elements
Diffstat (limited to 'src/libserver/html.c')
-rw-r--r-- | src/libserver/html.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c index d29463988..d36b8d6db 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1558,6 +1558,13 @@ rspamd_html_process_style (rspamd_mempool_t *pool, struct html_block *bl, rspamd_html_process_color (c, p - c, &bl->background_color); msg_debug_html ("got bgcolor: %xd", bl->background_color.d.val); } + else if (klen == 7 && g_ascii_strncasecmp (key, "display", 7) == 0) { + if (p - c >= 4 && rspamd_substring_search_caseless (c, p - c, + "none", 4) != -1) { + bl->visible = FALSE; + msg_debug_html ("tag is not visible"); + } + } } key = NULL; @@ -1597,6 +1604,7 @@ rspamd_html_process_block_tag (rspamd_mempool_t *pool, struct html_tag *tag, cur = tag->params->head; bl = rspamd_mempool_alloc0 (pool, sizeof (*bl)); bl->tag = tag; + bl->visible = TRUE; while (cur) { comp = cur->data; @@ -2111,7 +2119,14 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc, } else if (!(cur_tag->flags & FL_CLOSING) && (cur_tag->flags & FL_BLOCK)) { + struct html_block *bl; + rspamd_html_process_block_tag (pool, cur_tag, hc); + bl = cur_tag->extra; + + if (bl && !bl->visible) { + state = content_ignore; + } } } else { |