diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-06 13:50:38 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-06 13:50:38 +0100 |
commit | c11f9e68e6dc5891f9584a0a7e443153657b7737 (patch) | |
tree | 0827669411f16a75cfb8b66369f6a78243b5a4c6 /src/libserver/html.c | |
parent | ba8e4d7a11106893fa518aa96f46ba7c22205080 (diff) | |
download | rspamd-c11f9e68e6dc5891f9584a0a7e443153657b7737.tar.gz rspamd-c11f9e68e6dc5891f9584a0a7e443153657b7737.zip |
[Feature] Add count to url structure
Diffstat (limited to 'src/libserver/html.c')
-rw-r--r-- | src/libserver/html.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c index 40f8f9f64..186376567 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1578,7 +1578,7 @@ static void rspamd_process_html_url (rspamd_mempool_t *pool, struct rspamd_url *url, GHashTable *target) { - struct rspamd_url *query_url; + struct rspamd_url *query_url, *existing; gchar *url_str; gint rc; @@ -1599,12 +1599,15 @@ rspamd_process_html_url (rspamd_mempool_t *pool, struct rspamd_url *url, msg_debug_html ("found url %s in query of url" " %*s", url_str, url->querylen, url->query); - if (!g_hash_table_lookup (target, - query_url)) { + if ((existing = g_hash_table_lookup (target, + query_url)) == NULL) { g_hash_table_insert (target, query_url, query_url); } + else { + existing->count ++; + } } } } @@ -2102,6 +2105,8 @@ rspamd_html_check_displayed_url (rspamd_mempool_t *pool, turl->flags |= RSPAMD_URL_FLAG_HTML_DISPLAYED; turl->flags &= ~RSPAMD_URL_FLAG_FROM_TEXT; } + + turl->count ++; } else { g_hash_table_insert (target_tbl, @@ -2504,6 +2509,7 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc, g_hash_table_insert (target_tbl, url, url); } else { + turl->count ++; url = NULL; } |