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

H

henry.jykim

Hi, all.

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

HEADERS = {
'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

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top