aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/html.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-03-06 23:49:16 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-03-06 23:49:16 +0000
commitb7467f9d294faf54f25d2b2fc32255f613097416 (patch)
tree886f7f9afd9aafc114845e83494ab840f544d78f /src/libserver/html.c
parent291131f98a0b80195202278a35f1eaace104af81 (diff)
downloadrspamd-b7467f9d294faf54f25d2b2fc32255f613097416.tar.gz
rspamd-b7467f9d294faf54f25d2b2fc32255f613097416.zip
[Fix] Urls: Fix processing of html urls when it comes to the flags
Issue: #3664
Diffstat (limited to 'src/libserver/html.c')
-rw-r--r--src/libserver/html.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c
index 974b59129..aa1cdf6cc 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -1764,7 +1764,7 @@ 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) && 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);
}
@@ -1903,7 +1903,7 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag,
if (img->url) {
img->url->flags |= RSPAMD_URL_FLAG_IMAGE;
- if (rspamd_url_set_add_or_increase (url_set, img->url) &&
+ if (rspamd_url_set_add_or_increase(url_set, img->url, false) &&
part_urls) {
g_ptr_array_add (part_urls, img->url);
}
@@ -3245,10 +3245,15 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool,
if (url != NULL) {
if (url_set != NULL) {
- if (rspamd_url_set_add_or_increase (url_set, url)) {
+ struct rspamd_url *maybe_existing =
+ rspamd_url_set_add_or_return (url_set, url);
+ if (maybe_existing == url) {
rspamd_process_html_url (pool, url, url_set,
part_urls);
}
+ else {
+ url = maybe_existing;
+ }
}
href_offset = dest->len;