static void
rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag,
- struct html_content *hc)
+ struct html_content *hc, GHashTable *urls)
{
struct html_tag_component *comp;
struct html_image *img;
else {
img->flags |= RSPAMD_HTML_FLAG_IMAGE_EXTERNAL;
if (img->src) {
+
img->url = rspamd_html_process_url (pool,
img->src, fstr.len, NULL);
+
+ if (img->url) {
+ struct rspamd_url *turl = g_hash_table_lookup (urls,
+ img->url);
+
+ img->url->flags |= RSPAMD_URL_FLAG_IMAGE;
+
+ if (turl == NULL) {
+ g_hash_table_insert (urls, img->url, img->url);
+ }
+ else {
+ turl->count++;
+ }
+ }
}
}
}
}
if (cur_tag->id == Tag_IMG && !(cur_tag->flags & FL_CLOSING)) {
- rspamd_html_process_img_tag (pool, cur_tag, hc);
+ rspamd_html_process_img_tag (pool, cur_tag, hc, urls);
}
else if (cur_tag->flags & FL_BLOCK) {
struct html_block *bl;
RSPAMD_URL_FLAG_UNNORMALISED = 1u << 16u,
RSPAMD_URL_FLAG_ZW_SPACES = 1u << 17u,
RSPAMD_URL_FLAG_DISPLAY_URL = 1u << 18u,
+ RSPAMD_URL_FLAG_IMAGE = 1u << 19u,
};
struct rspamd_url_tag {
PUSH_FLAG (RSPAMD_URL_FLAG_UNNORMALISED, "unnormalised");
PUSH_FLAG (RSPAMD_URL_FLAG_ZW_SPACES, "zw_spaces");
PUSH_FLAG (RSPAMD_URL_FLAG_DISPLAY_URL, "url_displayed");
+ PUSH_FLAG (RSPAMD_URL_FLAG_IMAGE, "image");
}
else {
return luaL_error (L, "invalid arguments");