]> source.dussan.org Git - rspamd.git/commitdiff
Remove deprecated function.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 16 Jul 2015 18:12:33 +0000 (19:12 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 16 Jul 2015 18:12:33 +0000 (19:12 +0100)
src/libserver/html.c

index dbc3d20c686cd4b73e95ddcec377c482f452272e..18a71930f4e918e6e6c9efbd1256aacddd55b9b0 100644 (file)
@@ -850,124 +850,6 @@ rspamd_html_url_is_phished (rspamd_mempool_t *pool,
 
 }
 
-static void
-parse_tag_url (struct rspamd_task *task,
-       struct mime_text_part *part,
-       tag_id_t id,
-       gchar *tag_text,
-       gsize tag_len,
-       gsize remain)
-{
-       gchar *c = NULL, *p, *url_text;
-       gint len, rc;
-       struct rspamd_url *url;
-       gboolean got_single_quote = FALSE, got_double_quote = FALSE;
-
-       /* For A tags search for href= and for IMG tags search for src= */
-       if (id == Tag_A) {
-               c = rspamd_strncasestr (tag_text, "href=", tag_len);
-               len = sizeof ("href=") - 1;
-       }
-       else if (id == Tag_IMG) {
-               c = rspamd_strncasestr (tag_text, "src=", tag_len);
-               len = sizeof ("src=") - 1;
-       }
-
-       if (c != NULL) {
-               /* First calculate length */
-               c += len;
-               /* Skip spaces after eqsign */
-               while (g_ascii_isspace (*c)) {
-                       c++;
-               }
-               len = 0;
-               p = c;
-               while (*p && (guint)(p - tag_text) < tag_len) {
-                       if (got_double_quote) {
-                               if (*p == '"') {
-                                       break;
-                               }
-                               else {
-                                       len++;
-                               }
-                       }
-                       else if (got_single_quote) {
-                               if (*p == '\'') {
-                                       break;
-                               }
-                               else {
-                                       len++;
-                               }
-                       }
-                       else if (g_ascii_isspace (*p) || *p == '>' ||
-                               (*p == '/' && *(p + 1) == '>') || *p == '\r' || *p == '\n') {
-                               break;
-                       }
-                       else {
-                               if (*p == '"' && !got_single_quote) {
-                                       got_double_quote = !got_double_quote;
-                               }
-                               else if (*p == '\'' && !got_double_quote) {
-                                       got_single_quote = !got_single_quote;
-                               }
-                               else {
-                                       len++;
-                               }
-                       }
-                       p++;
-               }
-
-               if (got_single_quote || got_double_quote) {
-                       c++;
-               }
-
-               if (len == 0) {
-                       return;
-               }
-
-               url_text = rspamd_mempool_alloc (task->task_pool, len + 1);
-               rspamd_strlcpy (url_text, c, len + 1);
-               len = rspamd_html_decode_entitles_inplace (url_text, len);
-
-               if (g_ascii_strncasecmp (url_text, "http",
-                       sizeof ("http") - 1) != 0 &&
-                       g_ascii_strncasecmp (url_text, "www",
-                       sizeof ("www") - 1) != 0 &&
-                       g_ascii_strncasecmp (url_text, "ftp://",
-                       sizeof ("ftp://") - 1) != 0 &&
-                       g_ascii_strncasecmp (url_text, "mailto:",
-                       sizeof ("mailto:") - 1) != 0) {
-
-                       return;
-               }
-
-               url = rspamd_mempool_alloc (task->task_pool, sizeof (struct rspamd_url));
-               rc = rspamd_url_parse (url, url_text, len, task->task_pool);
-
-               if (rc == URI_ERRNO_OK && url->hostlen != 0) {
-                       /*
-                        * Check for phishing
-                        */
-                       if ((p = strchr (c, '>')) != NULL && id == Tag_A) {
-                               p++;
-                               check_phishing (task, url, p, remain - (p - tag_text), id);
-                       }
-                       if (url->protocol == PROTOCOL_MAILTO) {
-                               if (url->userlen > 0) {
-                                       if (!g_hash_table_lookup (task->emails, url)) {
-                                               g_hash_table_insert (task->emails, url, url);
-                                       }
-                               }
-                       }
-                       else {
-                               if (!g_hash_table_lookup (task->urls, url)) {
-                                       g_hash_table_insert (task->urls, url, url);
-                               }
-                       }
-               }
-       }
-}
-
 static gboolean
 rspamd_html_process_tag (rspamd_mempool_t *pool, struct html_content *hc,
                struct html_tag *tag, GNode **cur_level, gboolean *balanced)