Software /
code /
prosody
Comparison
plugins/mod_compression.lua @ 1716:3f7fd1445d02
mod_compression: Fixed some undefined global accesses
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 18 Aug 2009 19:56:16 +0500 |
parent | 1679:e2eb0eaf2544 |
child | 1718:af3d0c329396 |
comparison
equal
deleted
inserted
replaced
1713:252afc358000 | 1716:3f7fd1445d02 |
---|---|
48 local status, deflate_stream = pcall(zlib.deflate, compression_level); | 48 local status, deflate_stream = pcall(zlib.deflate, compression_level); |
49 if status == false then | 49 if status == false then |
50 local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); | 50 local error_st = st.stanza("failure", {xmlns=xmlns_compression_protocol}):tag("setup-failed"); |
51 session.send(error_st); | 51 session.send(error_st); |
52 session:log("error", "Failed to create zlib.deflate filter."); | 52 session:log("error", "Failed to create zlib.deflate filter."); |
53 module:log("error", inflate_stream); | 53 module:log("error", deflate_stream); |
54 return | 54 return |
55 end | 55 end |
56 | 56 |
57 local status, inflate_stream = pcall(zlib.inflate); | 57 local status, inflate_stream = pcall(zlib.inflate); |
58 if status == false then | 58 if status == false then |
86 session.data = function(conn, data) | 86 session.data = function(conn, data) |
87 local status, decompressed, eof = pcall(inflate_stream, data); | 87 local status, decompressed, eof = pcall(inflate_stream, data); |
88 if status == false then | 88 if status == false then |
89 session:close({ | 89 session:close({ |
90 condition = "undefined-condition"; | 90 condition = "undefined-condition"; |
91 text = compressed; | 91 text = decompressed; |
92 extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); | 92 extra = st.stanza("failure", {xmlns="http://jabber.org/protocol/compress"}):tag("processing-failed"); |
93 }); | 93 }); |
94 module:log("error", compressed); | 94 module:log("error", decompressed); |
95 return; | 95 return; |
96 end | 96 end |
97 old_data(conn, decompressed); | 97 old_data(conn, decompressed); |
98 end; | 98 end; |
99 end | 99 end |