in reply to Re^2: uncompress gzip data in a callback
in thread uncompress gzip data in a callback

The problem is, the :content_cb callback gets called with odd sized chunks of data as they are received, and if you pass those to inflate(), you just get ' data error'.

I've tried accumulating the odd sized chunks as they arrive, and passing the buffer to inflate() as they accumulate, but it has never actually decoded anything until the entire request has completed.

And if you have to accumulate the entire content before decoding it, you might as well skip the callback and let LWP decode it for you.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^4: uncompress gzip data in a callback
by pmqs (Friar) on May 04, 2010 at 16:03 UTC
    That sounds like you aren't maintaining the context of the compressed data stream between invocations of inflate. The code I posted earlier today shows how to handle that.