Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

when I read gzipped response from web-servers, GzipReader returns sometimes 'invalid compressed data -- crc error'

24 views
Skip to first unread message

henry...@gmail.com

unread,
Apr 8, 2013, 11:51:58 AM4/8/13
to
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?
0 new messages