mod_bosh: Return a proper BOSH error response from XML parse error callback (see...
authorKim Alvefur <zash@zash.se>
Tue, 19 Apr 2016 10:19:15 +0000 (12:19 +0200)
committerKim Alvefur <zash@zash.se>
Tue, 19 Apr 2016 10:19:15 +0000 (12:19 +0200)
plugins/mod_bosh.lua

index 6ec3ff1680f144a9ec28a4a308822937bc8977d1..1f928eed5d05ea9a7777407bf6ee604685c4f4a0 100644 (file)
@@ -412,8 +412,9 @@ function stream_callbacks.error(context, error)
        log("debug", "Error parsing BOSH request payload; %s", error);
        if not context.sid then
                local response = context.response;
-               response.status_code = 400;
-               response:send();
+               local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
+                       ["xmlns:stream"] = xmlns_streams, condition = "bad-request" });
+               response:send(tostring(close_reply));
                return;
        end