Comparison

plugins/mod_c2s.lua @ 5228:edabb34417b7

mod_c2s: Check if TLS compression is used
author Kim Alvefur <zash@zash.se>
date Sun, 09 Dec 2012 11:50:09 +0100
parent 5120:bcabea740c00
child 5281:815c689f85ad
comparison
equal deleted inserted replaced
5227:97f395938028 5228:edabb34417b7
64 64
65 -- If session.secure is *false* (not nil) then it means we /were/ encrypting 65 -- If session.secure is *false* (not nil) then it means we /were/ encrypting
66 -- since we now have a new stream header, session is secured 66 -- since we now have a new stream header, session is secured
67 if session.secure == false then 67 if session.secure == false then
68 session.secure = true; 68 session.secure = true;
69
70 -- Check if TLS compression is used
71 local sock = session.conn:socket();
72 if sock.info then
73 session.compressed = sock:info"compression";
74 elseif sock.compression then
75 session.compressed = sock:compression(); --COMPAT mw/luasec-hg
76 end
69 end 77 end
70 78
71 local features = st.stanza("stream:features"); 79 local features = st.stanza("stream:features");
72 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features }); 80 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features });
73 module:fire_event("stream-features", session, features); 81 module:fire_event("stream-features", session, features);
187 session.log("info", "Client connected"); 195 session.log("info", "Client connected");
188 196
189 -- Client is using legacy SSL (otherwise mod_tls sets this flag) 197 -- Client is using legacy SSL (otherwise mod_tls sets this flag)
190 if conn:ssl() then 198 if conn:ssl() then
191 session.secure = true; 199 session.secure = true;
200
201 -- Check if TLS compression is used
202 local sock = conn:socket();
203 if sock.info then
204 session.compressed = sock:info"compression";
205 elseif sock.compression then
206 session.compressed = sock:compression(); --COMPAT mw/luasec-hg
207 end
192 end 208 end
193 209
194 if opt_keepalives then 210 if opt_keepalives then
195 conn:setoption("keepalive", opt_keepalives); 211 conn:setoption("keepalive", opt_keepalives);
196 end 212 end