]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] It seems we still need raw urls...
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 14 Apr 2021 15:14:43 +0000 (16:14 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 14 Apr 2021 15:14:43 +0000 (16:14 +0100)
src/libserver/url.c
src/libserver/url.h
src/lua/lua_url.c

index fb4b4da94913191c4f4131395e8276ce47501f00..01bb527f09870fa592b815ccd0dae6baaa2a0fb9 100644 (file)
@@ -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);
index 0a36ca17b0cae7fc314841c3fbbbb94ba66b20f6..fe3124308c13d1ffd77877ac3a070b3026220f2f 100644 (file)
@@ -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 {
index d77d4b27d41d5e5ad3d439f4c86e146b531b40a7..c2dade139d40c6ddc1b1d66e947c1f044c132ddd 100644 (file)
@@ -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);