Skip to content

Commit

Permalink
fix(http): Use the right protocol for proxies (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
Max1Truc authored Nov 23, 2023
1 parent 13f2b3c commit fa69770
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/http.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit fa69770

Please sign in to comment.