Diff

plugins/mod_bosh.lua @ 7380:d24d88feed76

mod_bosh: Return a proper BOSH error response from XML parse error callback (see #343)
author Kim Alvefur <zash@zash.se>
date Tue, 19 Apr 2016 12:19:15 +0200
parent 7379:250855633092
child 7381:a05bf94646ba
line wrap: on
line diff
--- a/plugins/mod_bosh.lua	Tue Apr 19 12:18:19 2016 +0200
+++ b/plugins/mod_bosh.lua	Tue Apr 19 12:19:15 2016 +0200
@@ -412,8 +412,9 @@
 	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