fix(http): use the right protocol for proxies

This commit is contained in:
Max1Truc 2022-08-23 15:28:45 +02:00
parent 95b7efa9da
commit bd0f2ea49a

View File

@ -219,7 +219,8 @@ local function adjustproxy(reqt)
local proxy = reqt.proxy or _M.PROXY local proxy = reqt.proxy or _M.PROXY
if proxy then if proxy then
proxy = url.parse(proxy) proxy = url.parse(proxy)
return proxy.host, proxy.port or 3128 local proxy_create = SCHEMES[proxy.scheme].create(reqt)
return proxy.host, proxy.port or 3128, proxy_create
else else
return reqt.host, reqt.port return reqt.host, reqt.port
end end
@ -291,7 +292,7 @@ local function adjustrequest(reqt)
end end
-- ajust host and port if there is a proxy -- ajust host and port if there is a proxy
nreqt.host, nreqt.port = adjustproxy(nreqt) nreqt.host, nreqt.port, nreqt.create = adjustproxy(nreqt)
return nreqt return nreqt
end end