diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-16 11:42:35 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-16 11:42:35 +0000 |
commit | fa330c601d43ea40b84edcb22465f1740d72babc (patch) | |
tree | 6fdfe4953a6ae7d8e8894dcde1ba895f7bd7eb4e /src | |
parent | bae50a7929a1acca7c33ae26d41261f7e3217d1d (diff) | |
download | rspamd-fa330c601d43ea40b84edcb22465f1740d72babc.tar.gz rspamd-fa330c601d43ea40b84edcb22465f1740d72babc.zip |
[Fix] Fix base tag processing according to stupid HTML renderer behaviour
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/html.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c index de6e104b4..5bb3ca05b 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -60,7 +60,7 @@ static struct html_tag_def tag_defs[] = { TAG_DEF(Tag_APPLET, "applet", (CM_OBJECT | CM_IMG | CM_INLINE | CM_PARAM)), TAG_DEF(Tag_AREA, "area", (CM_BLOCK | CM_EMPTY | FL_HREF)), TAG_DEF(Tag_B, "b", (CM_INLINE|FL_BLOCK)), - TAG_DEF(Tag_BASE, "base", (CM_HEAD | CM_EMPTY | FL_HREF)), + TAG_DEF(Tag_BASE, "base", (CM_HEAD | CM_EMPTY)), TAG_DEF(Tag_BASEFONT, "basefont", (CM_INLINE | CM_EMPTY)), TAG_DEF(Tag_BDO, "bdo", (CM_INLINE)), TAG_DEF(Tag_BIG, "big", (CM_INLINE)), @@ -3031,28 +3031,20 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc, } } else if (cur_tag->id == Tag_BASE && !(cur_tag->flags & (FL_CLOSING))) { - struct html_tag *prev_tag = NULL; - - if (cur_level && cur_level->parent) { - prev_tag = cur_level->parent->data; - } - /* - * Base is allowed only within head tag but we slightly - * relax that + * Base is allowed only within head tag but HTML is retarded */ - if (!prev_tag || prev_tag->id == Tag_HEAD || - prev_tag->id == Tag_HTML) { + if (hc->base_url == NULL) { url = rspamd_html_process_url_tag (pool, cur_tag, hc); if (url != NULL) { - if (hc->base_url == NULL) { - /* We have a base tag available */ - hc->base_url = url; - } - + msg_debug_html ("got valid base tag"); + hc->base_url = url; cur_tag->extra = url; } + else { + msg_debug_html ("got invalid base tag!"); + } } } |