Software /
code /
prosody
Comparison
plugins/mod_websocket.lua @ 7760:801d4c8e0f58
mod_websocket: Add some debug messages
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 04 Dec 2016 11:52:22 +0100 |
parent | 7716:779a9ef6b4fd |
child | 7761:e0e1f6d6fb4f |
comparison
equal
deleted
inserted
replaced
7759:69706084bdfe | 7760:801d4c8e0f58 |
---|---|
146 (request.headers.sec_websocket_protocol or ""):gsub("([^,]*),?", function (proto) | 146 (request.headers.sec_websocket_protocol or ""):gsub("([^,]*),?", function (proto) |
147 if proto == "xmpp" then wants_xmpp = true; end | 147 if proto == "xmpp" then wants_xmpp = true; end |
148 end); | 148 end); |
149 | 149 |
150 if not wants_xmpp then | 150 if not wants_xmpp then |
151 module:log("debug", "Client didn't want to talk XMPP, list of protocols was %s", request.headers.sec_websocket_protocol or "(empty)"); | |
151 return 501; | 152 return 501; |
152 end | 153 end |
153 | 154 |
154 local function websocket_close(code, message) | 155 local function websocket_close(code, message) |
155 conn:write(build_close(code, message)); | 156 conn:write(build_close(code, message)); |
285 response.headers.connection = "Upgrade"; | 286 response.headers.connection = "Upgrade"; |
286 response.headers.sec_webSocket_accept = base64(sha1(request.headers.sec_websocket_key .. "258EAFA5-E914-47DA-95CA-C5AB0DC85B11")); | 287 response.headers.sec_webSocket_accept = base64(sha1(request.headers.sec_websocket_key .. "258EAFA5-E914-47DA-95CA-C5AB0DC85B11")); |
287 response.headers.sec_webSocket_protocol = "xmpp"; | 288 response.headers.sec_webSocket_protocol = "xmpp"; |
288 response.headers.access_control_allow_origin = cross_domain; | 289 response.headers.access_control_allow_origin = cross_domain; |
289 | 290 |
291 session.log("debug", "Sending WebSocket handshake"); | |
292 | |
290 return ""; | 293 return ""; |
291 end | 294 end |
292 | 295 |
293 local function keepalive(event) | 296 local function keepalive(event) |
294 local session = event.session; | 297 local session = event.session; |