X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_bosh.lua;h=19f191c8bf6335a924d2de2876885d62453b184e;hb=c897664b4ff1fc4357cb0a3dc3abb955e57cf92d;hp=249c4792edb8ad21172db3dba14ecb891c671ffb;hpb=64654d4e178c5984b13f2281746e124d729d5545;p=prosody.git diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua index 249c4792..19f191c8 100644 --- a/plugins/mod_bosh.lua +++ b/plugins/mod_bosh.lua @@ -18,6 +18,7 @@ local core_process_stanza = prosody.core_process_stanza; local st = require "util.stanza"; local logger = require "util.logger"; local log = logger.init("mod_bosh"); +local initialize_filters = require "util.filters".initialize; local math_min = math.min; local xmlns_streams = "http://etherx.jabber.org/streams"; @@ -35,7 +36,7 @@ local bosh_max_wait = module:get_option_number("bosh_max_wait", 120); local consider_bosh_secure = module:get_option_boolean("consider_bosh_secure"); -local default_headers = { ["Content-Type"] = "text/xml; charset=utf-8" }; +local default_headers = { ["Content-Type"] = "text/xml; charset=utf-8", ["Connection"] = "keep-alive" }; local cross_domain = module:get_option("cross_domain_bosh", false); if cross_domain then @@ -254,6 +255,8 @@ function stream_callbacks.streamopened(context, attr) }; sessions[sid] = session; + local filter = initialize_filters(session); + session.log("debug", "BOSH session created for request from %s", session.ip); log("info", "New BOSH session, assigned it sid '%s'", sid); @@ -267,6 +270,7 @@ function stream_callbacks.streamopened(context, attr) s = st.clone(s); s.attr.xmlns = "jabber:client"; end + s = filter("stanzas/out", s); --log("debug", "Sending BOSH data: %s", tostring(s)); t_insert(session.send_buffer, tostring(s)); @@ -354,6 +358,7 @@ function stream_callbacks.handlestanza(context, stanza) if stanza.attr.xmlns == xmlns_bosh then stanza.attr.xmlns = nil; end + stanza = session.filter("stanzas/in", stanza); core_process_stanza(session, stanza); end end