From ad07122f42fd4310d37f84e74512ca883469d230 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Fri, 20 Nov 2009 17:12:12 +0100 Subject: Fixing some typos. --- plugins/mod_compression.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index f1cae737..ec9e24ec 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -14,10 +14,10 @@ local xmlns_compression_protocol = "http://jabber.org/protocol/compress" local compression_stream_feature = st.stanza("compression", {xmlns=xmlns_compression_feature}):tag("method"):text("zlib"):up(); local compression_level = module:get_option("compression_level"); - -- if not defined assume admin wants best compression if compression_level == nil then compression_level = 9 end; + compression_level = tonumber(compression_level); if not compression_level or compression_level < 1 or compression_level > 9 then module:log("warn", "Invalid compression level in config: %s", tostring(compression_level)); @@ -41,7 +41,7 @@ module:add_handler({"c2s_unauthed", "c2s"}, "compress", xmlns_compression_protoc if session.compressed then local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("unsupported-method"); session.send(error_st); - session:log("warn", "Tried to establish another compression layer."); + session.log("warn", "Tried to establish another compression layer."); end -- checking if the compression method is supported @@ -56,7 +56,7 @@ module:add_handler({"c2s_unauthed", "c2s"}, "compress", xmlns_compression_protoc if status == false then local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); session.send(error_st); - session:log("error", "Failed to create zlib.deflate filter."); + session.log("error", "Failed to create zlib.deflate filter."); module:log("error", deflate_stream); return end @@ -65,7 +65,7 @@ module:add_handler({"c2s_unauthed", "c2s"}, "compress", xmlns_compression_protoc if status == false then local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); session.send(error_st); - session:log("error", "Failed to create zlib.deflate filter."); + session.log("error", "Failed to create zlib.deflate filter."); module:log("error", inflate_stream); return end -- cgit v1.2.3 From 8db68f17623ad29b25c6b5d757a2fb0b3d3005c6 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Sun, 29 Nov 2009 21:32:39 +0100 Subject: Enable one way stream compression on s2s links. --- plugins/mod_compression.lua | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index ec9e24ec..096ed0d5 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -11,6 +11,7 @@ local pcall = pcall; local xmlns_compression_feature = "http://jabber.org/features/compress" local xmlns_compression_protocol = "http://jabber.org/protocol/compress" +local xmlns_stream = "http://etherx.jabber.org/streams"; local compression_stream_feature = st.stanza("compression", {xmlns=xmlns_compression_feature}):tag("method"):text("zlib"):up(); local compression_level = module:get_option("compression_level"); @@ -34,8 +35,39 @@ module:add_event_hook("stream-features", end ); +module:hook("s2s-stream-features", + function (data) + local session, features = data.session, data.features; + -- FIXME only advertise compression support when TLS layer has no compression enabled + features:add_child(compression_stream_feature); + end +); + +-- S2Sout handling aka the client perspective in the S2S connection +module:hook_stanza(xmlns_stream, "features", + function (session, stanza) + if not session.compressed then + module:log("debug", "FEATURES: "..stanza:pretty_print()) + -- does remote server support compression? + local comp_st = stanza:child_with_name("compression"); + if comp_st then + -- do we support the mechanism + for a in comp_st:children() do + local algorithm = a[1] + if algorithm == "zlib" then + session.sends2s(st.stanza("compress", {xmlns=xmlns_compression_protocol}):text("zlib")) + session.log("info", "Enabled compression using zlib.") + return true; + end + end + session.log("debug", "Remote server supports no compression algorithm we support.") + end + end + end +, 250); + -- TODO Support compression on S2S level too. -module:add_handler({"c2s_unauthed", "c2s"}, "compress", xmlns_compression_protocol, +module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress", xmlns_compression_protocol, function(session, stanza) -- fail if we are already compressed if session.compressed then @@ -48,14 +80,14 @@ module:add_handler({"c2s_unauthed", "c2s"}, "compress", xmlns_compression_protoc local method = stanza:child_with_name("method")[1]; if method == "zlib" then session.log("info", method.." compression selected."); - session.send(st.stanza("compressed", {xmlns=xmlns_compression_protocol})); + (session.sends2s or session.send)(st.stanza("compressed", {xmlns=xmlns_compression_protocol})); session:reset_stream(); -- create deflate and inflate streams local status, deflate_stream = pcall(zlib.deflate, compression_level); if status == false then local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); - session.send(error_st); + (session.sends2s or session.send)(error_st); session.log("error", "Failed to create zlib.deflate filter."); module:log("error", deflate_stream); return @@ -64,7 +96,7 @@ module:add_handler({"c2s_unauthed", "c2s"}, "compress", xmlns_compression_protoc local status, inflate_stream = pcall(zlib.inflate); if status == false then local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); - session.send(error_st); + (session.sends2s or session.send)(error_st); session.log("error", "Failed to create zlib.deflate filter."); module:log("error", inflate_stream); return @@ -116,7 +148,8 @@ module:add_handler({"c2s_unauthed", "c2s"}, "compress", xmlns_compression_protoc else session.log("info", method.." compression selected. But we don't support it."); local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("unsupported-method"); - session.send(error_st); + (session.sends2s or session.send)(error_st); end end ); + -- cgit v1.2.3 From b1743dfea11540cdf60fa26b560318f4a4b4fe84 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Sun, 29 Nov 2009 22:02:21 +0100 Subject: mod_compression: Prepare activating of compression on s2s. --- plugins/mod_compression.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 096ed0d5..72573b93 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -8,7 +8,6 @@ local st = require "util.stanza"; local zlib = require "zlib"; local pcall = pcall; - local xmlns_compression_feature = "http://jabber.org/features/compress" local xmlns_compression_protocol = "http://jabber.org/protocol/compress" local xmlns_stream = "http://etherx.jabber.org/streams"; @@ -55,7 +54,7 @@ module:hook_stanza(xmlns_stream, "features", for a in comp_st:children() do local algorithm = a[1] if algorithm == "zlib" then - session.sends2s(st.stanza("compress", {xmlns=xmlns_compression_protocol}):text("zlib")) + session.sends2s(st.stanza("compress", {xmlns=xmlns_compression_protocol}):tag("method"):text("zlib")) session.log("info", "Enabled compression using zlib.") return true; end @@ -67,6 +66,12 @@ module:hook_stanza(xmlns_stream, "features", , 250); -- TODO Support compression on S2S level too. +module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compression_protocol, + function(session ,stanza) + session.log("debug", "Activating compression...") + end +); + module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress", xmlns_compression_protocol, function(session, stanza) -- fail if we are already compressed -- cgit v1.2.3 From c7c629d9c8eda79fd6fd2d7e57f528d028554a50 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Sun, 29 Nov 2009 22:18:06 +0100 Subject: mod_compression: Moving compression setup in a dedicated function. --- plugins/mod_compression.lua | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 72573b93..2a6c0871 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -108,21 +108,24 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress end -- setup compression for session.w - local old_send = session.send; + local function setup_compression(session) + local old_send = session.send; - session.send = function(t) - local status, compressed, eof = pcall(deflate_stream, tostring(t), 'sync'); - if status == false then - session:close({ - condition = "undefined-condition"; - text = compressed; - extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); - }); - module:log("warn", compressed); - return; - end - old_send(compressed); - end; + session.send = function(t) + local status, compressed, eof = pcall(deflate_stream, tostring(t), 'sync'); + if status == false then + session:close({ + condition = "undefined-condition"; + text = compressed; + extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); + }); + module:log("warn", compressed); + return; + end + old_send(compressed); + end; + end + setup_compression(session); -- setup decompression for session.data local function setup_decompression(session) -- cgit v1.2.3 From b7799b239e6ff80e2c12afdc3762bf76c9f148f7 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Sun, 29 Nov 2009 23:04:19 +0100 Subject: mod_compression: Make setup_compression work for s2s sessions too. --- plugins/mod_compression.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 2a6c0871..aecfaedb 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -109,9 +109,9 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress -- setup compression for session.w local function setup_compression(session) - local old_send = session.send; - - session.send = function(t) + local old_send = (session.sends2s or session.send); + + local new_send = function(t) local status, compressed, eof = pcall(deflate_stream, tostring(t), 'sync'); if status == false then session:close({ @@ -124,6 +124,9 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress end old_send(compressed); end; + + if session.sends2s then session.sends2s = new_send + elseif session.send then session.send = new_send end end setup_compression(session); -- cgit v1.2.3 From 6dd1e48964ba159b21916e50e4a04df55060dae7 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Sun, 29 Nov 2009 23:43:12 +0100 Subject: mod_compression: Some further refactoring. --- plugins/mod_compression.lua | 129 +++++++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 55 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index aecfaedb..b7e4cd8c 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -65,6 +65,73 @@ module:hook_stanza(xmlns_stream, "features", end , 250); + +-- returns either nil or a fully functional ready to use inflate stream +local function get_deflate_stream(session) + local status, deflate_stream = pcall(zlib.deflate, compression_level); + if status == false then + local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); + (session.sends2s or session.send)(error_st); + session.log("error", "Failed to create zlib.deflate filter."); + module:log("error", deflate_stream); + return + end + return deflate_stream +end + +-- returns either nil or a fully functional ready to use inflate stream +local function get_inflate_stream(session) + local status, inflate_stream = pcall(zlib.inflate); + if status == false then + local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); + (session.sends2s or session.send)(error_st); + session.log("error", "Failed to create zlib.deflate filter."); + module:log("error", inflate_stream); + return + end + return inflate_stream +end + +-- setup compression for a stream +local function setup_compression(session, deflate_stream) + local old_send = (session.sends2s or session.send); + + local new_send = function(t) + local status, compressed, eof = pcall(deflate_stream, tostring(t), 'sync'); + if status == false then + session:close({ + condition = "undefined-condition"; + text = compressed; + extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); + }); + module:log("warn", compressed); + return; + end + old_send(compressed); + end; + + if session.sends2s then session.sends2s = new_send + elseif session.send then session.send = new_send end +end + +-- setup decompression for a stream +local function setup_decompression(session, inflate_stream) + local old_data = session.data + session.data = function(conn, data) + local status, decompressed, eof = pcall(inflate_stream, data); + if status == false then + session:close({ + condition = "undefined-condition"; + text = decompressed; + extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); + }); + module:log("warn", decompressed); + return; + end + old_data(conn, decompressed); + end; +end + -- TODO Support compression on S2S level too. module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compression_protocol, function(session ,stanza) @@ -89,70 +156,22 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress session:reset_stream(); -- create deflate and inflate streams - local status, deflate_stream = pcall(zlib.deflate, compression_level); - if status == false then - local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); - (session.sends2s or session.send)(error_st); - session.log("error", "Failed to create zlib.deflate filter."); - module:log("error", deflate_stream); - return - end + deflate_stream = get_deflate_stream(session); + if not deflate_stream then return end - local status, inflate_stream = pcall(zlib.inflate); - if status == false then - local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); - (session.sends2s or session.send)(error_st); - session.log("error", "Failed to create zlib.deflate filter."); - module:log("error", inflate_stream); - return - end + inflate_stream = get_inflate_stream(session); + if not inflate_stream then return end -- setup compression for session.w - local function setup_compression(session) - local old_send = (session.sends2s or session.send); - - local new_send = function(t) - local status, compressed, eof = pcall(deflate_stream, tostring(t), 'sync'); - if status == false then - session:close({ - condition = "undefined-condition"; - text = compressed; - extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); - }); - module:log("warn", compressed); - return; - end - old_send(compressed); - end; - - if session.sends2s then session.sends2s = new_send - elseif session.send then session.send = new_send end - end - setup_compression(session); + setup_compression(session, deflate_stream); -- setup decompression for session.data - local function setup_decompression(session) - local old_data = session.data - session.data = function(conn, data) - local status, decompressed, eof = pcall(inflate_stream, data); - if status == false then - session:close({ - condition = "undefined-condition"; - text = decompressed; - extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); - }); - module:log("warn", decompressed); - return; - end - old_data(conn, decompressed); - end; - end - setup_decompression(session); + setup_decompression(session, inflate_stream); local session_reset_stream = session.reset_stream; session.reset_stream = function(session) session_reset_stream(session); - setup_decompression(session); + setup_decompression(session, inflate_stream); return true; end; session.compressed = true; -- cgit v1.2.3 From 4d1368b58f7aafa6593bcff2d9684441e09fbc4d Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Mon, 30 Nov 2009 23:23:42 +0100 Subject: mod_compression: Enabeling compression for outgoing s2s streams. --- plugins/mod_compression.lua | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index b7e4cd8c..e160faed 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -38,7 +38,10 @@ module:hook("s2s-stream-features", function (data) local session, features = data.session, data.features; -- FIXME only advertise compression support when TLS layer has no compression enabled - features:add_child(compression_stream_feature); + if not session.compressed then + module:log("debug", "s2s-stream-features YAY YAHOO") + features:add_child(compression_stream_feature); + end end ); @@ -97,6 +100,8 @@ local function setup_compression(session, deflate_stream) local old_send = (session.sends2s or session.send); local new_send = function(t) + --TODO: Better code injection in the sending process + session.log(t) local status, compressed, eof = pcall(deflate_stream, tostring(t), 'sync'); if status == false then session:close({ @@ -107,7 +112,7 @@ local function setup_compression(session, deflate_stream) module:log("warn", compressed); return; end - old_send(compressed); + session.conn:write(compressed); end; if session.sends2s then session.sends2s = new_send @@ -136,6 +141,30 @@ end module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compression_protocol, function(session ,stanza) session.log("debug", "Activating compression...") + -- create deflate and inflate streams + deflate_stream = get_deflate_stream(session); + if not deflate_stream then return end + + inflate_stream = get_inflate_stream(session); + if not inflate_stream then return end + + -- setup compression for session.w + setup_compression(session, deflate_stream); + + -- setup decompression for session.data + setup_decompression(session, inflate_stream); + local session_reset_stream = session.reset_stream; + session.reset_stream = function(session) + session_reset_stream(session); + setup_decompression(session, inflate_stream); + return true; + end; + session:reset_stream(); + local default_stream_attr = {xmlns = "jabber:server", ["xmlns:stream"] = "http://etherx.jabber.org/streams", + version = "1.0", to = session.to_host, from = session.from_host}; + session.sends2s(""); + session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag()); + session.compressed = true; end ); @@ -144,7 +173,7 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress -- fail if we are already compressed if session.compressed then local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("unsupported-method"); - session.send(error_st); + (session.sends2s or session.send)(error_st); session.log("warn", "Tried to establish another compression layer."); end @@ -152,8 +181,6 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress local method = stanza:child_with_name("method")[1]; if method == "zlib" then session.log("info", method.." compression selected."); - (session.sends2s or session.send)(st.stanza("compressed", {xmlns=xmlns_compression_protocol})); - session:reset_stream(); -- create deflate and inflate streams deflate_stream = get_deflate_stream(session); @@ -162,6 +189,9 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress inflate_stream = get_inflate_stream(session); if not inflate_stream then return end + (session.sends2s or session.send)(st.stanza("compressed", {xmlns=xmlns_compression_protocol})); + session:reset_stream(); + -- setup compression for session.w setup_compression(session, deflate_stream); -- cgit v1.2.3 From 7f176701d2a3569561ae96ac8796e814d2b5314f Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 1 Dec 2009 00:10:47 +0100 Subject: mod_compression: Define db (dialback) namespace in stream header. --- plugins/mod_compression.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index e160faed..3372bd0e 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -161,7 +161,7 @@ module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compressio end; session:reset_stream(); local default_stream_attr = {xmlns = "jabber:server", ["xmlns:stream"] = "http://etherx.jabber.org/streams", - version = "1.0", to = session.to_host, from = session.from_host}; + ["xmlns:db"] = 'jabber:server:dialback', version = "1.0", to = session.to_host, from = session.from_host}; session.sends2s(""); session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag()); session.compressed = true; -- cgit v1.2.3 From dcfc9865db2d9cb9db94dd7cb89081ae256f0aee Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 1 Dec 2009 00:21:32 +0100 Subject: mod_compression: Removing forgotten debugging output. --- plugins/mod_compression.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 3372bd0e..802e1822 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -39,7 +39,6 @@ module:hook("s2s-stream-features", local session, features = data.session, data.features; -- FIXME only advertise compression support when TLS layer has no compression enabled if not session.compressed then - module:log("debug", "s2s-stream-features YAY YAHOO") features:add_child(compression_stream_feature); end end @@ -49,7 +48,6 @@ module:hook("s2s-stream-features", module:hook_stanza(xmlns_stream, "features", function (session, stanza) if not session.compressed then - module:log("debug", "FEATURES: "..stanza:pretty_print()) -- does remote server support compression? local comp_st = stanza:child_with_name("compression"); if comp_st then -- cgit v1.2.3 From 62ab9da69a6a86f1de31b589dbaa6c7bf97730b7 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 1 Dec 2009 20:59:42 +0100 Subject: mod_compression: Some comment clean up. --- plugins/mod_compression.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 802e1822..15a10059 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -44,7 +44,7 @@ module:hook("s2s-stream-features", end ); --- S2Sout handling aka the client perspective in the S2S connection +-- Hook to activate compression if remote server supports it. module:hook_stanza(xmlns_stream, "features", function (session, stanza) if not session.compressed then @@ -135,7 +135,6 @@ local function setup_decompression(session, inflate_stream) end; end --- TODO Support compression on S2S level too. module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compression_protocol, function(session ,stanza) session.log("debug", "Activating compression...") -- cgit v1.2.3 From 81e7039c89e147fd315eef738eb2a4505ea7b715 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 1 Dec 2009 21:04:02 +0100 Subject: mod_compression: Declaring the de-/compression pipes as local. --- plugins/mod_compression.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 15a10059..6364c27f 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -139,10 +139,10 @@ module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compressio function(session ,stanza) session.log("debug", "Activating compression...") -- create deflate and inflate streams - deflate_stream = get_deflate_stream(session); + local deflate_stream = get_deflate_stream(session); if not deflate_stream then return end - inflate_stream = get_inflate_stream(session); + local inflate_stream = get_inflate_stream(session); if not inflate_stream then return end -- setup compression for session.w @@ -180,10 +180,10 @@ module:add_handler({"c2s_unauthed", "c2s", "s2sin_unauthed", "s2sin"}, "compress session.log("info", method.." compression selected."); -- create deflate and inflate streams - deflate_stream = get_deflate_stream(session); + local deflate_stream = get_deflate_stream(session); if not deflate_stream then return end - inflate_stream = get_inflate_stream(session); + local inflate_stream = get_inflate_stream(session); if not inflate_stream then return end (session.sends2s or session.send)(st.stanza("compressed", {xmlns=xmlns_compression_protocol})); -- cgit v1.2.3 From 8c48053170aa1d6f0bfc057edf6fd7ede1c6a507 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 1 Dec 2009 21:17:13 +0100 Subject: mod_compression: Removing trailing whitespace. --- plugins/mod_compression.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 6364c27f..8fdf9dcc 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -160,7 +160,7 @@ module:add_handler({"s2sout_unauthed", "s2sout"}, "compressed", xmlns_compressio local default_stream_attr = {xmlns = "jabber:server", ["xmlns:stream"] = "http://etherx.jabber.org/streams", ["xmlns:db"] = 'jabber:server:dialback', version = "1.0", to = session.to_host, from = session.from_host}; session.sends2s(""); - session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag()); + session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag()); session.compressed = true; end ); -- cgit v1.2.3