aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/html.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-14 10:47:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-14 10:47:15 +0100
commit33d268331ab00e377a83e3078c53042254630cf1 (patch)
tree24c438711d3838199ce1c7bc38e61568743fc8a2 /src/libserver/html.c
parentc1f283a15d00ff9b77b899c7d7a00d16fbbb80a1 (diff)
downloadrspamd-33d268331ab00e377a83e3078c53042254630cf1.tar.gz
rspamd-33d268331ab00e377a83e3078c53042254630cf1.zip
[Minor] Propagate images flag
Diffstat (limited to 'src/libserver/html.c')
-rw-r--r--src/libserver/html.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c
index 8dc8a8dac..5e29b3b84 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -1765,7 +1765,8 @@ rspamd_html_url_query_callback (struct rspamd_url *url, gsize start_offset,
url->flags |= RSPAMD_URL_FLAG_QUERY;
- if (rspamd_url_set_add_or_increase(cbd->url_set, url, false) && cbd->part_urls) {
+ if (rspamd_url_set_add_or_increase (cbd->url_set, url, false)
+ && cbd->part_urls) {
g_ptr_array_add (cbd->part_urls, url);
}
@@ -1902,10 +1903,22 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag,
img->src, fstr.len, NULL);
if (img->url) {
+ struct rspamd_url *existing;
+
img->url->flags |= RSPAMD_URL_FLAG_IMAGE;
+ existing = rspamd_url_set_add_or_return (url_set, img->url);
- if (rspamd_url_set_add_or_increase(url_set, img->url, false) &&
- part_urls) {
+ if (existing != img->url) {
+ /*
+ * We have some other URL that could be
+ * found, e.g. from another part. However,
+ * we still want to set an image flag on it
+ */
+ existing->flags |= img->url->flags;
+ existing->count ++;
+ }
+ else if (part_urls) {
+ /* New url */
g_ptr_array_add (part_urls, img->url);
}
}