diff options
author | Max1Truc <26603929+Max1Truc@users.noreply.github.com> | 2023-11-23 05:01:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-23 08:01:29 +0300 |
commit | fa69770e52ba869feb8339d49e7c3c536953fbde (patch) | |
tree | dfa527caf1bf13e9ec2df0393b348d3c2f0caafe /src | |
parent | 13f2b3c663d9fa5c464782a0bfccb30bcc017b0c (diff) | |
download | luasocket-fa69770e52ba869feb8339d49e7c3c536953fbde.tar.gz luasocket-fa69770e52ba869feb8339d49e7c3c536953fbde.tar.bz2 luasocket-fa69770e52ba869feb8339d49e7c3c536953fbde.zip |
fix(http): Use the right protocol for proxies (#386)
Diffstat (limited to 'src')
-rw-r--r-- | src/http.lua | 11 |
1 files 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) | |||
219 | local proxy = reqt.proxy or _M.PROXY | 219 | local proxy = reqt.proxy or _M.PROXY |
220 | if proxy then | 220 | if proxy then |
221 | proxy = url.parse(proxy) | 221 | proxy = url.parse(proxy) |
222 | return proxy.host, proxy.port or 3128 | 222 | proxy.port = proxy.port or 3128 |
223 | proxy.create = SCHEMES[proxy.scheme].create(reqt) | ||
224 | return proxy.host, proxy.port, proxy.create | ||
223 | else | 225 | else |
224 | return reqt.host, reqt.port | 226 | return reqt.host, reqt.port, reqt.create |
225 | end | 227 | end |
226 | end | 228 | end |
227 | 229 | ||
@@ -291,7 +293,10 @@ local function adjustrequest(reqt) | |||
291 | end | 293 | end |
292 | 294 | ||
293 | -- ajust host and port if there is a proxy | 295 | -- ajust host and port if there is a proxy |
294 | nreqt.host, nreqt.port = adjustproxy(nreqt) | 296 | local proxy_create |
297 | nreqt.host, nreqt.port, proxy_create = adjustproxy(nreqt) | ||
298 | if not reqt.create then nreqt.create = proxy_create end | ||
299 | |||
295 | return nreqt | 300 | return nreqt |
296 | end | 301 | end |
297 | 302 | ||