Compression support for cohttp-lwt using decompress

CI Status

The library interface tries to stay somewhat close to dream-encoding.

Usage example:

let get_with_compression_support ?headers uri =
  let headers = Clz_cohttp.update_headers headers in
  let open Lwt.Syntax in
  let* resp, body = Cohttp_lwt_unix.Client.get ~headers uri in
  let status = Cohttp_lwt.Response.status resp in
  let* () = if status <> `OK then Cohttp_lwt.Body.drain_body body else Lwt.return_unit in
  match status with
  | `OK ->
    let body = Clz_cohttp.decompress (resp, body) in
    Lwt.return body
  | _ -> Lwt.fail_with "Not Ok"

It provides three libraries:

The documentation can be found on www.mseri.me/ocaml-clz/.

Why CLZ

The name was supposed to be temporary. Started as CUZ: Cohttp U gZip, but it really only supports cohttp-lwt, so it changed into CLS: Cohttp-Lwt-Zip, even if it supports both gzip and deflate. I use it in a lot of scripts now, more invasive changes would be way too time-consuming :P