openresty / lua-resty-websocket

WebSocket support for the ngx_lua module (and OpenResty)
506 stars 106 forks source link

unexpected connection behavior #47

Open warrenincn opened 4 years ago

warrenincn commented 4 years ago

When I connect to the websocket server using an unauthorized websocket url, the connect function does not return an error. I expect the connection to fail because the server will return a 401 status code. The corresponding code is resty/websocket/client.lua(line 197) m, err = re_match(header, [[^\sHTTP/1.1\s+]], "jo") why not change this line to m, err = re_match(header, [[^\sHTTP/1.1\s+101]], "jo")