Cache data to decompress until first error.

Otherwise switching the window size will fail anyway.
Added tests for chunked decoding.