]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add definition for schema-less urls
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 26 Mar 2018 10:38:03 +0000 (11:38 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 26 Mar 2018 10:38:03 +0000 (11:38 +0100)
Issue: #2090
Closes: #2090
src/libserver/html.c
src/libserver/url.c
src/libserver/url.h

index 53c16708b361c161016afec625a2056269120d86..c8917503d41147a6fe1b7c5b11e148bf52d79e84 100644 (file)
@@ -1563,6 +1563,10 @@ rspamd_html_process_url (rspamd_mempool_t *pool, const gchar *start, guint len,
                        url->flags |= RSPAMD_URL_FLAG_OBSCURED;
                }
 
+               if (no_prefix) {
+                       url->flags |= RSPAMD_URL_FLAG_SCHEMALESS;
+               }
+
                decoded = url->string;
                decoded_len = url->urllen;
 
index 272511a1caa05ca8d07aa5a784e8f74ebc5f1c4a..1665ff379413abab652218a8688b24b4a2bf0541 100644 (file)
@@ -2388,6 +2388,10 @@ rspamd_url_trie_generic_callback_common (struct rspamd_multipattern *mp,
                rc = rspamd_url_parse (url, cb->url_str, strlen (cb->url_str), pool);
 
                if (rc == URI_ERRNO_OK && url->hostlen > 0) {
+                       if (m.add_prefix) {
+                               url->flags |= RSPAMD_URL_FLAG_SCHEMALESS;
+                       }
+
                        if (cb->func) {
                                cb->func (url, cb->start - text, cb->fin - text, cb->funcd);
                        }
index 3c0ff759974cff96038be9d4e633fd02af3b0239..e6ccfc0f9938540cc284d1bfc7a4cee389d03e7c 100644 (file)
@@ -24,7 +24,8 @@ enum rspamd_url_flags {
        RSPAMD_URL_FLAG_MISSINGSLASHES = 1 << 11,
        RSPAMD_URL_FLAG_IDN = 1 << 12,
        RSPAMD_URL_FLAG_HAS_PORT = 1 << 13,
-       RSPAMD_URL_FLAG_HAS_USER = 1 << 12,
+       RSPAMD_URL_FLAG_HAS_USER = 1 << 14,
+       RSPAMD_URL_FLAG_SCHEMALESS = 1 << 15,
 };
 
 struct rspamd_url_tag {