lua-requests icon indicating copy to clipboard operation
lua-requests copied to clipboard

SSL / Proxy requests

Open jroakes opened this issue 9 years ago • 4 comments

Is there anyway to make get requests via this codebase using a proxy for https urls? Currently getting "proxy not supported"

jroakes avatar Feb 11 '16 22:02 jroakes

Changing line 102 to local socket = string.find(full_request.url, '^https:') and not request.proxy and https_socket or http_socket sent the proxy through socket.http and fixed the issue.

jroakes avatar Feb 11 '16 23:02 jroakes

Good catch. I made the fix and uploaded a new luarock.

JakobGreen avatar Feb 12 '16 00:02 JakobGreen

hmm. even with that, I noticed that I am getting <head><title>400 The plain HTTP request was sent to HTTPS port</title></head> using a proxy with the http transport on nginx sites (the ones I need). Any ideas. This is the closest thing I have found to working in lua for now. It needs a solid http/https library badly.

jroakes avatar Feb 12 '16 01:02 jroakes

Yeah unfortunately it looks like this isn't possible using LuaSec and LuaSocket how they currently are. Have you tried using the lua curl bindings? I know cURL supports different proxies pretty well so that might be able to do it. I have been considering trying it out for this library instead of LuaSec and LuaSocket because cURL has so many more features.

JakobGreen avatar Feb 12 '16 19:02 JakobGreen