Software /
code /
prosody
Changeset
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 |
parents | 3446:9c0b3cd890e9 |
children | 3448:0ca7c3864431 |
files | plugins/mod_bosh.lua |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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...");