Zlib provides automatic gzip detection for you so you don't need to skip over it by hand. From inflateInit2 in the zlib manual (also reflected in the Zlib::Inflate.new documentation):
Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format.
So you can replace L228 of EventMachine::HttpDecoders::Gzip with:
# zlib with automatic gzip detection
@zstream ||= Zlib::Inflate.new(32 + Zlib::MAX_WBITS)
And delete the code in GzipHeader to prevent bugs like #284/#301