Software / code / prosody-modules
Comparison
mod_websocket/mod_websocket.lua @ 1364:cc77341af5ee
mod_websocket: Multiple fixes for sending stream errors
| author | Florian Zeitz <florob@babelmonkeys.de> |
|---|---|
| date | Wed, 19 Mar 2014 20:11:58 +0100 |
| parent | 1340:3ffd64b4ab59 |
| child | 1397:4e36b68d68da |
comparison
equal
deleted
inserted
replaced
| 1363:478b3288192f | 1364:cc77341af5ee |
|---|---|
| 43 end | 43 end |
| 44 | 44 |
| 45 local xmlns_framing = "urn:ietf:params:xml:ns:xmpp-framing"; | 45 local xmlns_framing = "urn:ietf:params:xml:ns:xmpp-framing"; |
| 46 local xmlns_streams = "http://etherx.jabber.org/streams"; | 46 local xmlns_streams = "http://etherx.jabber.org/streams"; |
| 47 local xmlns_client = "jabber:client"; | 47 local xmlns_client = "jabber:client"; |
| 48 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; | |
| 48 | 49 |
| 49 module:depends("c2s") | 50 module:depends("c2s") |
| 50 local sessions = module:shared("c2s/sessions"); | 51 local sessions = module:shared("c2s/sessions"); |
| 51 local c2s_listener = portmanager.get_service("c2s").listener; | 52 local c2s_listener = portmanager.get_service("c2s").listener; |
| 52 | 53 |
| 168 end | 169 end |
| 169 elseif reason.name then -- a stanza | 170 elseif reason.name then -- a stanza |
| 170 stream_error = reason; | 171 stream_error = reason; |
| 171 end | 172 end |
| 172 end | 173 end |
| 173 stream_error = tostring(stream_error); | 174 log("debug", "Disconnecting client, <stream:error> is: %s", tostring(stream_error)); |
| 174 log("debug", "Disconnecting client, <stream:error> is: %s", stream_error); | |
| 175 session.send(stream_error); | 175 session.send(stream_error); |
| 176 end | 176 end |
| 177 | 177 |
| 178 session.send(st.stanza("close", { xmlns = xmlns_framing })); | 178 session.send(st.stanza("close", { xmlns = xmlns_framing })); |
| 179 function session.send() return false; end | 179 function session.send() return false; end |