Add a Gzip middleware

I rebased this, so it's a single commit. Hopefully the 1.8 works now.