Software /
code /
prosody
Comparison
plugins/mod_compression.lua @ 3223:ee2dabe699c9
mod_compression: Remove the unneccessary stream:reset() overloading, which was causing double decompression and c2s/s2s failures
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 10 Jun 2010 01:55:32 +0100 |
parent | 3202:1a8a5b89a5ad |
child | 3226:69e920d7c968 |
comparison
equal
deleted
inserted
replaced
3222:d0525df563c0 | 3223:ee2dabe699c9 |
---|---|
140 -- setup compression for session.w | 140 -- setup compression for session.w |
141 setup_compression(session, deflate_stream); | 141 setup_compression(session, deflate_stream); |
142 | 142 |
143 -- setup decompression for session.data | 143 -- setup decompression for session.data |
144 setup_decompression(session, inflate_stream); | 144 setup_decompression(session, inflate_stream); |
145 local session_reset_stream = session.reset_stream; | |
146 session.reset_stream = function(session) | |
147 session_reset_stream(session); | |
148 setup_decompression(session, inflate_stream); | |
149 return true; | |
150 end; | |
151 session:reset_stream(); | 145 session:reset_stream(); |
152 local default_stream_attr = {xmlns = "jabber:server", ["xmlns:stream"] = "http://etherx.jabber.org/streams", | 146 local default_stream_attr = {xmlns = "jabber:server", ["xmlns:stream"] = "http://etherx.jabber.org/streams", |
153 ["xmlns:db"] = 'jabber:server:dialback', version = "1.0", to = session.to_host, from = session.from_host}; | 147 ["xmlns:db"] = 'jabber:server:dialback', version = "1.0", to = session.to_host, from = session.from_host}; |
154 session.sends2s("<?xml version='1.0'?>"); | 148 session.sends2s("<?xml version='1.0'?>"); |
155 session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag()); | 149 session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag()); |
187 setup_compression(session, deflate_stream); | 181 setup_compression(session, deflate_stream); |
188 | 182 |
189 -- setup decompression for session.data | 183 -- setup decompression for session.data |
190 setup_decompression(session, inflate_stream); | 184 setup_decompression(session, inflate_stream); |
191 | 185 |
192 local session_reset_stream = session.reset_stream; | |
193 session.reset_stream = function(session) | |
194 session_reset_stream(session); | |
195 setup_decompression(session, inflate_stream); | |
196 return true; | |
197 end; | |
198 session.compressed = true; | 186 session.compressed = true; |
199 elseif method then | 187 elseif method then |
200 session.log("debug", "%s compression selected, but we don't support it.", tostring(method)); | 188 session.log("debug", "%s compression selected, but we don't support it.", tostring(method)); |
201 local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("unsupported-method"); | 189 local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("unsupported-method"); |
202 (session.sends2s or session.send)(error_st); | 190 (session.sends2s or session.send)(error_st); |