Mercurial > prosody-hg
comparison plugins/mod_compression.lua @ 1717:beadd8da061c
Merge with waqas
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 18 Aug 2009 15:59:58 +0100 |
| parents | 3f7fd1445d02 |
| children | af3d0c329396 |
comparison
equal
deleted
inserted
replaced
| 1715:3a5b6cd6b8c9 | 1717:beadd8da061c |
|---|---|
| 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 |
