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

Discussion in 'Ruby' started by henry.jykim@gmail.com, Apr 8, 2013.

  1. Guest

    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?
    , Apr 8, 2013
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Smith

    Can sqlite read gzipped databases?

    Paul Smith, Mar 21, 2007, in forum: Python
    Replies:
    1
    Views:
    946
    John Nagle
    Mar 21, 2007
  2. John Nagle
    Replies:
    1
    Views:
    578
    Martin v. Löwis
    Nov 22, 2007
  3. StephenSykes

    GzipReader problem

    StephenSykes, Aug 3, 2004, in forum: Ruby
    Replies:
    1
    Views:
    88
    Tanaka Akira
    Aug 3, 2004
  4. Jos Backus
    Replies:
    10
    Views:
    481
    Jeremy Bopp
    Feb 4, 2011
  5. DmitryB
    Replies:
    2
    Views:
    360
    Michele Dondi
    Jun 1, 2007
Loading...

Share This Page