Dolda2000 GitWeb
/
automanga.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5c00056
)
Decode gzipped pages on the fly in htcache.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Wed, 4 Dec 2013 00:04:53 +0000
(
01:04
+0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Wed, 4 Dec 2013 00:04:53 +0000
(
01:04
+0100)
manga/htcache.py
patch
|
blob
|
blame
|
history
diff --git
a/manga/htcache.py
b/manga/htcache.py
index
2f71f9a
..
4212db3
100644
(file)
--- a/
manga/htcache.py
+++ b/
manga/htcache.py
@@
-13,6
+13,9
@@
class cache(object):
def miss(self, url):
s = urllib.urlopen(url)
try:
+ if s.headers.get("content-encoding") == "gzip":
+ import gzip, StringIO
+ return gzip.GzipFile(fileobj=StringIO.StringIO(s.read()), mode="r").read()
return s.read()
finally:
s.close()