aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_bosh.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-04-19 12:16:17 +0200
committerKim Alvefur <zash@zash.se>2016-04-19 12:16:17 +0200
commit6b36fac8a3f5df6dc85d80607b23dcb830323309 (patch)
tree8c2b4c944e87ee1e5d7f3af7f4bf0dd1d2c4e5cd /plugins/mod_bosh.lua
parentfe7c4f17dd8c11ac130e9d898380deb36045d736 (diff)
downloadprosody-6b36fac8a3f5df6dc85d80607b23dcb830323309.tar.gz
prosody-6b36fac8a3f5df6dc85d80607b23dcb830323309.zip
mod_bosh: Return a proper BOSH error response instead of deprecated(?) status code (See #343)
Diffstat (limited to 'plugins/mod_bosh.lua')
-rw-r--r--plugins/mod_bosh.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index 845df61a..64d52f91 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -129,7 +129,9 @@ function handle_POST(event)
local ok, err = stream:feed(body);
if not ok then
module:log("warn", "Error parsing BOSH payload; %s", err)
- return 400;
+ local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
+ ["xmlns:stream"] = xmlns_streams, condition = "bad-request" });
+ return tostring(close_reply);
end
-- Stanzas (if any) in the request have now been processed, and
@@ -184,7 +186,9 @@ function handle_POST(event)
return; -- A response has been sent already
end
module:log("warn", "Unable to associate request with a session (incomplete request?)");
- return 400;
+ local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
+ ["xmlns:stream"] = xmlns_streams, condition = "item-not-found" });
+ return tostring(close_reply) .. "\n";
end