TS-1664 check vary and accept-encoding before adding them

This patch makes the gzip plugin check for existing vary and
accept-encoding headers before adding them. It also adds
error checking, making the compressor bail if it fail to add
the required headers