Skip to content

Commit dab685d

Browse files
author
tlipski
committed
fix for a broker server-side inflate implemention, for explaination please see http://stackoverflow.com/questions/3932117/handling-http-contentencoding-deflate
1 parent da05473 commit dab685d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/clj_http/util.clj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@
5959
"Returns a zlib inflate'd version of the given byte array."
6060
[b]
6161
(when b
62-
(IOUtils/toByteArray (InflaterInputStream. (ByteArrayInputStream. b)))))
62+
(try
63+
(IOUtils/toByteArray (InflaterInputStream. (ByteArrayInputStream. b)))
64+
(catch java.util.zip.ZipException e ;broken inflate implementation server-side,
65+
; see http://stackoverflow.com/questions/3932117/handling-http-contentencoding-deflate
66+
(IOUtils/toByteArray (InflaterInputStream. (ByteArrayInputStream. b) (java.util.zip.Inflater. true)))))))
6367

6468
(defn deflate
6569
"Returns a deflate'd version of the given byte array."

0 commit comments

Comments
 (0)