]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Ignore urls in head tag
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 23 Jun 2021 12:20:16 +0000 (13:20 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 23 Jun 2021 12:20:16 +0000 (13:20 +0100)
src/libserver/html/html.cxx

index 9261258bc834813b93e80728a350640d042e6146..324695bdff39cff6a964d01019a0a5dd58bd4969 100644 (file)
@@ -1257,7 +1257,7 @@ html_process_input(rspamd_mempool_t *pool,
 {
        const gchar *p, *c, *end, *start;
        guchar t;
-       gboolean closing = FALSE;
+       auto closing = false, in_head = false;
        guint obrace = 0, ebrace = 0;
        struct rspamd_url *url = NULL;
        gint href_offset = -1;
@@ -1559,8 +1559,12 @@ html_process_input(rspamd_mempool_t *pool,
                                        hc->tags_seen[cur_tag->id] = true;
                                }
 
+                               if (cur_tag->id == Tag_HEAD) {
+                                       in_head = !(cur_tag->flags & FL_CLOSING);
+                               }
+
                                /* XXX: uncomment when styles parsing is not so broken */
-                               if (cur_tag->flags & FL_HREF /* && !(cur_tag->flags & FL_IGNORE) */) {
+                               if (cur_tag->flags & FL_HREF && !in_head) {
                                        if (!(cur_tag->flags & (FL_CLOSING))) {
                                                auto maybe_url = html_process_url_tag(pool, cur_tag, hc);