when I read gzipped response from web-servers, GzipReader returnssometimes 'invalid compressed data



Hi, all.

to decode responses from web-servers, I am using GzipReader class to read it.

'Accept-Encoding' => 'gzip,deflate',
'Accept-Charset' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Keep-Alive' => '300',
'Connection' => 'keep-alive',
'Cache-Control' => 'max-age=0'

response = open(@url, HEADERS).read
contents = Zlib::GzipReader.new(StringIO.new(response)).read
json = JSON.load contents

but, sometimes, when I got 'crc error' caused by GzipRader.new().

line from zlib.rb
raise CRCError, 'invalid compressed data -- crc error' unless @crc == crc

the programs is under multi-threads.
using jruby 1.7.3

is this library having concurrency problems?


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question