httpCompress(message, data, callback) {
    if (message.headers["accept-encoding"]) {
      const encodings = message.headers["accept-encoding"]
        .split(",")
        .map((e) => e.trim().toLowerCase());

      let algorithm;
      let priority = -1;

      for (const encoding of encodings) {
        if (encoding.startsWith("gzip") || encoding.startsWith("deflate")) {
          let [_algorithm, _priority = "q=0"] = encoding.split(";");
          _priority = Number.parseFloat(_priority.split("=")[1] || 0);

          if (_priority > priority) {
            algorithm = _algorithm;
            priority = _priority;
          }
          // gzip should be the preferred algorithm in case of a tie
          else if (
            Math.abs(priority - _priority) < 10e-3 &&
            _algorithm === "gzip"
          ) {
            algorithm = "gzip";
          }
        }
      }

      if (algorithm === "gzip") {
        zlib.gzip(data, (err, compressed) =>
          callback({
            compressed: !err ? compressed : data,
            encoding: !err ? "gzip" : "identity",
          }),
        );
        return;
      } else if (algorithm === "deflate") {
        zlib.deflate(data, (err, compressed) =>
          callback({
            compressed: !err ? compressed : data,
            encoding: !err ? "deflate" : "identity",
          }),
        );
        return;
      }
    }

    callback({
      compressed: data,
      encoding: "identity",
    });
  }
Compress an outgoing message according to the
specified accept-encoding HTTP header

@param  {HttpMessage} message
@param  {Buffer} data
@param  {Function} callback