summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-07-24 10:37:22 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-07-24 10:37:22 +0100
commit414dd2d5b4eff49643617759db0eca0dd61ca39a (patch)
tree542a287c07eb57d25f3540bb3f096f795c0cd409 /src/lua
parenteef2f3cac7c975af050efaf4cf1acafcb9b501e3 (diff)
downloadrspamd-414dd2d5b4eff49643617759db0eca0dd61ca39a.tar.gz
rspamd-414dd2d5b4eff49643617759db0eca0dd61ca39a.zip
[Minor] Restore old port behaviour
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_url.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index a46f4e276..809bd36d3 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -186,7 +186,12 @@ lua_url_get_port (lua_State *L)
struct rspamd_lua_url *url = lua_check_url (L, 1);
if (url != NULL) {
- lua_pushinteger (L, rspamd_url_get_port(url->url));
+ if (rspamd_url_get_port_if_special(url->url) == 0) {
+ lua_pushnil (L);
+ }
+ else {
+ lua_pushinteger (L, rspamd_url_get_port_if_special(url->url));
+ }
}
else {
lua_pushnil (L);
@@ -679,9 +684,11 @@ lua_url_to_table (lua_State *L)
lua_settable (L, -3);
}
- lua_pushstring (L, "port");
- lua_pushinteger (L, rspamd_url_get_port(u));
- lua_settable (L, -3);
+ if (rspamd_url_get_port_if_special(u) != 0) {
+ lua_pushstring (L, "port");
+ lua_pushinteger (L, rspamd_url_get_port_if_special(u));
+ lua_settable (L, -3);
+ }
if (u->tldlen > 0) {
lua_pushstring (L, "tld");