# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1355050209 -3600
# Node ID edabb34417b72da9b9fe16ecd8fe9d890f42e49f
# Parent  97f3959380280bfe0d830415f1b54b755fbf1b71
mod_c2s: Check if TLS compression is used

diff -r 97f395938028 -r edabb34417b7 plugins/mod_c2s.lua
--- a/plugins/mod_c2s.lua	Sun Dec 09 11:44:45 2012 +0100
+++ b/plugins/mod_c2s.lua	Sun Dec 09 11:50:09 2012 +0100
@@ -66,6 +66,14 @@
 	-- since we now have a new stream header, session is secured
 	if session.secure == false then
 		session.secure = true;
+
+		-- Check if TLS compression is used
+		local sock = session.conn:socket();
+		if sock.info then
+			session.compressed = sock:info"compression";
+		elseif sock.compression then
+			session.compressed = sock:compression(); --COMPAT mw/luasec-hg
+		end
 	end
 
 	local features = st.stanza("stream:features");
@@ -189,6 +197,14 @@
 	-- Client is using legacy SSL (otherwise mod_tls sets this flag)
 	if conn:ssl() then
 		session.secure = true;
+
+		-- Check if TLS compression is used
+		local sock = conn:socket();
+		if sock.info then
+			session.compressed = sock:info"compression";
+		elseif sock.compression then
+			session.compressed = sock:compression(); --COMPAT mw/luasec-hg
+		end
 	end
 	
 	if opt_keepalives then