From: Vsevolod Stakhov Date: Mon, 26 Mar 2018 10:38:03 +0000 (+0100) Subject: [Minor] Add definition for schema-less urls X-Git-Tag: 1.7.3~110 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f7d0c75dbe19df430c15a5ac37ce39a9350f8a8;p=thirdparty%2Frspamd.git [Minor] Add definition for schema-less urls Issue: #2090 Closes: #2090 --- diff --git a/src/libserver/html.c b/src/libserver/html.c index 53c16708b3..c8917503d4 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -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; diff --git a/src/libserver/url.c b/src/libserver/url.c index 272511a1ca..1665ff3794 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -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); } diff --git a/src/libserver/url.h b/src/libserver/url.h index 3c0ff75997..e6ccfc0f99 100644 --- a/src/libserver/url.h +++ b/src/libserver/url.h @@ -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 {