summaryrefslogtreecommitdiffstats
path: root/news
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2014-03-17 00:58:26 +0100
committertv <tv@nomic.retiolum>2014-03-17 00:58:26 +0100
commite13c7bcd25311ce7b446074343bf733322edc992 (patch)
tree81a0ae7a75fc1ff28b09c394c7b6c532d1793f77 /news
parentcb259188f3f7c9b5c37a5b11692b5c7c5f1e146a (diff)
newsbot.js: handle gzip/deflate content-encoding
Diffstat (limited to 'news')
-rw-r--r--news/newsbot.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/news/newsbot.js b/news/newsbot.js
index 62609f00..4171e968 100644
--- a/news/newsbot.js
+++ b/news/newsbot.js
@@ -95,6 +95,17 @@ function create_feedbot (nick, uri, channels) {
if (response.statusCode !== 200) {
return this.emit('error', new Error('Bad status code'))
}
+ var output = res
+ switch (res.headers['content-encoding']) {
+ case 'gzip':
+ output = zlib.createGunzip()
+ res.pipe(output)
+ break
+ case 'deflate':
+ output = zlib.createInflate()
+ res.pipe(output)
+ break
+ }
this.pipe(feedparser)
})