]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Store multiple base tags (but use only first one as usually)
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Aug 2021 16:37:21 +0000 (17:37 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Aug 2021 16:37:21 +0000 (17:37 +0100)
src/libserver/html/html.cxx

index ef7fb35bab9b43607555c58ec5b3a0619f889342..e4cc137b43ddc2da9f4badb505e99d066cf20f8b 100644 (file)
@@ -1413,19 +1413,23 @@ html_process_input(rspamd_mempool_t *pool,
                        /*
                         * Base is allowed only within head tag but HTML is retarded
                         */
-                       if (hc->base_url == NULL) {
-                               auto maybe_url = html_process_url_tag(pool, cur_tag, hc);
+                       auto maybe_url = html_process_url_tag(pool, cur_tag, hc);
+
+                       if (maybe_url) {
+                               msg_debug_html ("got valid base tag");
+                               cur_tag->extra = maybe_url.value();
+                               cur_tag->flags |= FL_HREF;
 
-                               if (maybe_url) {
-                                       msg_debug_html ("got valid base tag");
+                               if (hc->base_url == nullptr) {
                                        hc->base_url = maybe_url.value();
-                                       cur_tag->extra = maybe_url.value();
-                                       cur_tag->flags |= FL_HREF;
                                }
                                else {
-                                       msg_debug_html ("got invalid base tag!");
+                                       msg_debug_html ("ignore redundant base tag");
                                }
                        }
+                       else {
+                               msg_debug_html ("got invalid base tag!");
+                       }
                }
 
                if (cur_tag->id == Tag_IMG) {