lua-resty-http icon indicating copy to clipboard operation
lua-resty-http copied to clipboard

[Feat] Support ws and wss scheme in http_connect.lua

Open GuyLewin opened this issue 3 years ago • 4 comments

GuyLewin avatar Oct 22 '21 15:10 GuyLewin

This all looks good to me, but I'm not sure I understand the use case? How does this make sense as compared to say, the client in lua-resty-websocket?

Can you think of any useful tests we might add?

pintsized avatar Nov 23 '21 12:11 pintsized

@pintsized I'll add tests, no problem. We use your library as a proxy server, in which case we want to send any HTTP request the customer sends - even the initial HTTP(S) request to a WebSocket server. In our code we then check if the response contains the Upgrade header and the HTTP 101 status. If it does - we take the inner socket and work directly with it. But we still use your library as a generic way to send the first HTTP request :) If it makes sense - I'll write some tests and commit.

GuyLewin avatar Nov 23 '21 14:11 GuyLewin

@GuyLewin Ah ok, got it, thanks. Sounds good to me.

pintsized avatar Nov 23 '21 14:11 pintsized

@pintsized added tests, also added support for 'ws' and 'wss' scheme in parse_uri (which I think is important because users would probably parse_uri() before they connect())

GuyLewin avatar Nov 24 '21 16:11 GuyLewin