Software /
code /
prosody
Comparison
plugins/mod_compression.lua @ 6358:55fda5deb5d5
mod_compression: Handle compression setup errors by logging a warning about it (fixes #408)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 26 Aug 2014 12:19:27 +0200 |
parent | 6040:b3b1c9da38fb |
child | 6367:769a3577dd85 |
comparison
equal
deleted
inserted
replaced
6357:ccae56e34956 | 6358:55fda5deb5d5 |
---|---|
145 session.compressed = true; | 145 session.compressed = true; |
146 return true; | 146 return true; |
147 end | 147 end |
148 end); | 148 end); |
149 | 149 |
150 module:hook("stanza/http://jabber.org/protocol/compress:failure", function(event) | |
151 local err = event.stanza:get_child(); | |
152 (event.origin.log or module._log)("warn", "Compression setup failed (%s)", err and err.name or "unknown reason"); | |
153 return true; | |
154 end); | |
155 | |
150 module:hook("stanza/http://jabber.org/protocol/compress:compress", function(event) | 156 module:hook("stanza/http://jabber.org/protocol/compress:compress", function(event) |
151 local session, stanza = event.origin, event.stanza; | 157 local session, stanza = event.origin, event.stanza; |
152 | 158 |
153 if session.type == "c2s" or session.type == "s2sin" then | 159 if session.type == "c2s" or session.type == "s2sin" then |
154 -- fail if we are already compressed | 160 -- fail if we are already compressed |