Fri, 06 Aug 2010 01:57:20 +0100
mod_bosh: Add error callback for xmlhandlers, to handle the case of invalid or unusable XML in the request payload
plugins/mod_bosh.lua | file | annotate | diff | comparison | revisions |
--- a/plugins/mod_bosh.lua Tue Aug 03 21:37:06 2010 +0500 +++ b/plugins/mod_bosh.lua Fri Aug 06 01:57:20 2010 +0100 @@ -293,6 +293,21 @@ end end +function stream_callbacks.error(request, error) + log("debug", "Error parsing BOSH request payload; %s", error); + if not request.sid then + request:send({ headers = default_headers, status = "400 Bad Request" }); + return; + end + + local session = sessions[request.sid]; + if error == "stream-error" then -- Remote stream error, we close normally + session:close(); + else + session:close({ condition = "bad-format", text = "Error processing stream" }); + end +end + local dead_sessions = {}; function on_timer() -- log("debug", "Checking for requests soon to timeout...");