Comparison

plugins/mod_bosh.lua @ 3447:cc2dc55e66f9

mod_bosh: Add error callback for xmlhandlers, to handle the case of invalid or unusable XML in the request payload
author Matthew Wild <mwild1@gmail.com>
date Fri, 06 Aug 2010 01:57:20 +0100
parent 3439:3d1eacf45230
child 3448:0ca7c3864431
comparison
equal deleted inserted replaced
3446:9c0b3cd890e9 3447:cc2dc55e66f9
291 session.ip = request.handler:ip(); 291 session.ip = request.handler:ip();
292 core_process_stanza(session, stanza); 292 core_process_stanza(session, stanza);
293 end 293 end
294 end 294 end
295 295
296 function stream_callbacks.error(request, error)
297 log("debug", "Error parsing BOSH request payload; %s", error);
298 if not request.sid then
299 request:send({ headers = default_headers, status = "400 Bad Request" });
300 return;
301 end
302
303 local session = sessions[request.sid];
304 if error == "stream-error" then -- Remote stream error, we close normally
305 session:close();
306 else
307 session:close({ condition = "bad-format", text = "Error processing stream" });
308 end
309 end
310
296 local dead_sessions = {}; 311 local dead_sessions = {};
297 function on_timer() 312 function on_timer()
298 -- log("debug", "Checking for requests soon to timeout..."); 313 -- log("debug", "Checking for requests soon to timeout...");
299 -- Identify requests timing out within the next few seconds 314 -- Identify requests timing out within the next few seconds
300 local now = os_time() + 3; 315 local now = os_time() + 3;