Software /
code /
prosody-modules
Diff
mod_websocket/mod_websocket.lua @ 844:a0987c0e4e1d
mod_websocket: Check whether the xmpp sub-protocol was requested
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 05 Oct 2012 19:44:23 +0200 |
parent | 842:32df4d13f178 |
child | 849:6e2ec1825182 |
line wrap: on
line diff
--- a/mod_websocket/mod_websocket.lua Fri Oct 05 19:34:53 2012 +0200 +++ b/mod_websocket/mod_websocket.lua Fri Oct 05 19:44:23 2012 +0200 @@ -446,7 +446,14 @@ </body></html>]]; end - -- TODO: Handle requested subprotocols + local wants_xmpp = false; + (request.headers.sec_websocket_protocol or ""):gsub("([^,]*),?", function (proto) + if proto == "xmpp" then wants_xmpp = true; end + end); + + if not wants_xmpp then + return 501; + end response.conn:setlistener(listener); response.status = "101 Switching Protocols";