From 930610eb1c4752415cef0bcd848e6d444600b891 Mon Sep 17 00:00:00 2001 From: Renato Foot Date: Wed, 1 Nov 2023 00:16:37 +0000 Subject: [PATCH] imp: improve URL parsing - Get full URL path - Check and accept URL without port Signed-off-by: Renato Foot --- modules/client_entergame/entergame.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index 2d76c78114..1800241476 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -401,8 +401,16 @@ function EnterGame.tryHttpLogin(clientVersion) onCharacterList(nil, characters, account) end - local host, path = G.host:match("([^/]+)/([^/]+)") - HTTP.post(host .. ':' .. G.port .. '/' .. path, + local host, path = G.host:match("([^/]+)/([^/].*)") + local url = G.host + + if G.port ~= nil and path ~= nil then + url = host .. ':' .. G.port .. '/' .. path + elseif path ~= nil then + url = host .. '/' .. path + end + + HTTP.post(url, json.encode({ email = G.account, password = G.password, @@ -453,7 +461,7 @@ function EnterGame.doLogin() g_settings.set('client-version', clientVersion) if clientVersion >= 1281 and G.port ~= 7171 then - if G.port == nil or G.port == 0 then + if G.port == 0 then G.port = 80 end