Requesting HTTPS over an HTTP proxy doesn't work
When requesting an HTTPS url over an HTTP proxy, LuaSocket tries to initiate a TLS session with the proxy server.
This works with mitmproxy, but not with other proxies.
Is it intended behavior ?
Otherwise, I can submit a PR to use the HTTP create function when an HTTP proxy is used.
I don't have much time to research the current or correct behavior, but will help facilitate a PR if one comes. From reading the issue at least that situation does sound like a bug.
It seems to me most clients requesting HTTPS over an HTTP proxy would simply ask for a TCP tunnel with CONNECT.
However, doing a GET https://[...], like for HTTP over an HTTP proxy, works on the proxies I tested.
I'm going to send the snippet that doesn't work later.
As to the PR, I'm working on it.
for inspiration; lua-resty-http does include proxy support; https://github.com/ledgetech/lua-resty-http
Thanks for the insiration.
Some features lua-resty-http supports:
- Proxied HTTP is requested with a request like
GET http://...while proxied HTTPS is requested with aCONNECT host:port - Two different proxy settings when proxying HTTP or HTTPS
- A
no_proxysetting, to specify which hosts shouldn't be reached over a proxy
For now, I do not intend to provide any of these features in the PR.
It seems sufficient to send a GET https://... to the proxy server. I just read the RFCs and it seems this does not break the specifications, but don't take my word for it.
I'll also test this against some proxies I find to check if this works in practice.
Should I add back the proxy tests ? (in test/httptest.lua)