+htp #15910 import coding infrastructure from spray

Fixes #15910.

This still needs some tests but the implementation is itself is ready to be reviewed.
I can't comment on the correctness of the gzip implementation, but it's very clear and readable. :+1: