I'm trying to implement HTTP/S proxy using stream-lua-ngx-module.
Implementing HTTP is quite easy as the protocol is easy to parse. However HTTPS support is a different beast.
Basically what I want to do is pipe data between input socket and output socket. Just reading available data and passing it around like: https://metacpan.org/source/BOOK/HTTP-Proxy-0.304/lib/HTTP/Proxy.pm#L626-656
Hoewever, the cosocket API in openresty does not really allow to do so as it:
* can't set 0 timeout (https://github.com/openresty/stream-lua-nginx-module/blob/0ee4e89e239cbd9a2bc9de50fd138220e9b5a57a/src/ngx_stream_lua_socket_tcp.c#L2786-L2795)
* and is going to wait for the data to be available
I see there is receiveany coming for cosockets in the next release, but it is not there for the raw socket.
I'm I missing something or this is not really good fit for OpenResty?
Cheers
Michal