zlib inflate error : Z_DATA_ERROR while decompress partial gzip compressed data

406 Views Asked by At

Application Scenario:

I receive many network packets, and group them by tcp stream. I can make sure that the packets that from one specific. The first received packet is the head of gzip content(0x1f 0x8b 0x08...), so I initialize the zlib_steam and then can decompress this packet successfully, but I cannot make sure the following received packet is Arrive in order(they may be out-of-order or lost), When the received packet is not the next packet of pre-packet, zlib_steam mostly failed to decompress the packet.

So I have the question: If you give me a partial compressed gzip data(for example one HTTP packet with gzip content-encoding but it's just a part of the complete gzip content), can zlib decompress it successfully?

0

There are 0 best solutions below