From fa69770e52ba869feb8339d49e7c3c536953fbde Mon Sep 17 00:00:00 2001 From: Max1Truc <26603929+Max1Truc@users.noreply.github.com> Date: Thu, 23 Nov 2023 05:01:29 +0000 Subject: [PATCH] fix(http): Use the right protocol for proxies (#386) --- src/http.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/http.lua b/src/http.lua index bda0744..e93003d 100644 --- a/src/http.lua +++ b/src/http.lua @@ -219,9 +219,11 @@ local function adjustproxy(reqt) local proxy = reqt.proxy or _M.PROXY if proxy then proxy = url.parse(proxy) - return proxy.host, proxy.port or 3128 + proxy.port = proxy.port or 3128 + proxy.create = SCHEMES[proxy.scheme].create(reqt) + return proxy.host, proxy.port, proxy.create else - return reqt.host, reqt.port + return reqt.host, reqt.port, reqt.create end end @@ -291,7 +293,10 @@ local function adjustrequest(reqt) end -- ajust host and port if there is a proxy - nreqt.host, nreqt.port = adjustproxy(nreqt) + local proxy_create + nreqt.host, nreqt.port, proxy_create = adjustproxy(nreqt) + if not reqt.create then nreqt.create = proxy_create end + return nreqt end