Software /
code /
prosody
Changeset
7377:6c98e783272a
mod_bosh: Return a proper BOSH error response instead of deprecated(?) status code (See #343)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 19 Apr 2016 12:16:17 +0200 (2016-04-19) |
parents | 7376:f9a5d9f60561 |
children | 7378:d15cfe8627ad |
files | plugins/mod_bosh.lua |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_bosh.lua Tue Apr 19 12:15:20 2016 +0200 +++ b/plugins/mod_bosh.lua Tue Apr 19 12:16:17 2016 +0200 @@ -129,7 +129,9 @@ 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 @@ 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