fix(http): Use the right protocol for proxies (#386)

This commit is contained in:
Max1Truc 2023-11-23 05:01:29 +00:00 committed by GitHub
parent 13f2b3c663
commit fa69770e52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,9 +219,11 @@ 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 proxy.port = proxy.port or 3128
proxy.create = SCHEMES[proxy.scheme].create(reqt)
return proxy.host, proxy.port, proxy.create
else else
return reqt.host, reqt.port return reqt.host, reqt.port, reqt.create
end end
end end
@ -291,7 +293,10 @@ 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) local proxy_create
nreqt.host, nreqt.port, proxy_create = adjustproxy(nreqt)
if not reqt.create then nreqt.create = proxy_create end
return nreqt return nreqt
end end