aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-14 16:14:43 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-14 16:14:43 +0100
commit4358f493cc2365982c10e9c80e9a73bf5e6bc584 (patch)
tree956829e236b7472d207ca047c8264bf260602c8b
parent202c18cb66b7cf16ecfe6542580e38b7e3c4bab6 (diff)
downloadrspamd-4358f493cc2365982c10e9c80e9a73bf5e6bc584.tar.gz
rspamd-4358f493cc2365982c10e9c80e9a73bf5e6bc584.zip
[Minor] It seems we still need raw urls...
-rw-r--r--src/libserver/url.c3
-rw-r--r--src/libserver/url.h14
-rw-r--r--src/lua/lua_url.c2
3 files changed, 11 insertions, 8 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index fb4b4da94..01bb527f0 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -2225,6 +2225,9 @@ rspamd_url_parse (struct rspamd_url *uri,
len = end - uristring;
}
+ uri->raw = p;
+ uri->rawlen = len;
+
if (flags & RSPAMD_URL_FLAG_MISSINGSLASHES) {
len += 2;
uri->string = rspamd_mempool_alloc (pool, len + 1);
diff --git a/src/libserver/url.h b/src/libserver/url.h
index 0a36ca17b..fe3124308 100644
--- a/src/libserver/url.h
+++ b/src/libserver/url.h
@@ -45,26 +45,26 @@ struct rspamd_url_tag {
struct rspamd_url_tag *prev, *next;
};
+
struct rspamd_url {
gchar *string;
+ gchar *raw;
gchar *visible_part;
struct rspamd_url *phished_url;
guint32 flags;
- guint16 protocol;
- guint16 protocollen;
- guint16 port;
+ guint8 protocol;
+ guint8 protocollen;
+ guint16 port;
guint16 usershift;
guint16 hostshift;
guint16 datashift;
guint16 queryshift;
guint16 fragmentshift;
guint16 tldshift;
-
-
guint16 userlen;
guint16 hostlen;
guint16 datalen;
@@ -72,8 +72,8 @@ struct rspamd_url {
guint16 fragmentlen;
guint16 tldlen;
guint16 count;
-
guint16 urllen;
+ guint16 rawlen;
};
#define rspamd_url_user(u) ((u)->userlen > 0 ? (u)->string + (u)->usershift : NULL)
@@ -106,7 +106,7 @@ enum rspamd_url_protocol {
PROTOCOL_HTTPS = 1u << 3u,
PROTOCOL_MAILTO = 1u << 4u,
PROTOCOL_TELEPHONE = 1u << 5u,
- PROTOCOL_UNKNOWN = 1u << 15u,
+ PROTOCOL_UNKNOWN = 1u << 7u,
};
enum rspamd_url_parse_flags {
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index d77d4b27d..c2dade139 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -348,7 +348,7 @@ lua_url_get_raw (lua_State *L)
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
- lua_pushlstring (L, url->url->string, url->url->urllen);
+ lua_pushlstring (L, url->url->raw, url->url->rawlen);
}
else {
lua_pushnil (L);