# HG changeset patch # User Florian Zeitz # Date 1349459063 -7200 # Node ID a0987c0e4e1d7f367c6c6e37259f0d4fbb9375b8 # Parent cdc67f4efde21865553249c5e2953ea697838fa7 mod_websocket: Check whether the xmpp sub-protocol was requested diff -r cdc67f4efde2 -r a0987c0e4e1d mod_websocket/mod_websocket.lua --- 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 @@ ]]; 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";