diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-26 11:38:03 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-26 11:38:03 +0100 |
commit | 3f7d0c75dbe19df430c15a5ac37ce39a9350f8a8 (patch) | |
tree | b20065472e410d16775f43369d6610962aa6fad9 | |
parent | abe4ed805d3c48d1d5ff5fe2e28c15a1eeb69540 (diff) | |
download | rspamd-3f7d0c75dbe19df430c15a5ac37ce39a9350f8a8.tar.gz rspamd-3f7d0c75dbe19df430c15a5ac37ce39a9350f8a8.zip |
[Minor] Add definition for schema-less urls
Issue: #2090
Closes: #2090
-rw-r--r-- | src/libserver/html.c | 4 | ||||
-rw-r--r-- | src/libserver/url.c | 4 | ||||
-rw-r--r-- | src/libserver/url.h | 3 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c index 53c16708b..c8917503d 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 272511a1c..1665ff379 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 3c0ff7599..e6ccfc0f9 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 { |