Revert "Reworked gzip/deflate encoding to reduce duplication"

This reverts commit c99feee2fd6c7b53c448fbb94980d1164cdefe23.
Working generalization of gzip/deflate encodes