From 187d957cb8ba7ced5327f63c4a8b611397e04cd9 Mon Sep 17 00:00:00 2001 From: Shon Feder Date: Thu, 28 Nov 2024 20:59:08 -0500 Subject: [PATCH] Update for cohttp 6 Response API Cohttp 6 introduced a breaking change to the `Response` API dropping `flush` in https://github.com/mirage/ocaml-cohttp/pull/1052 This updates our usage to be compatible. --- opam-repo-ci-web.opam | 2 +- web-ui/github.ml | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/opam-repo-ci-web.opam b/opam-repo-ci-web.opam index b06a771b..0268fcc5 100644 --- a/opam-repo-ci-web.opam +++ b/opam-repo-ci-web.opam @@ -29,7 +29,7 @@ depends: [ "prometheus-app" "cmdliner" {>= "1.1.0"} "lwt" - "cohttp-lwt-unix" {>= "2.2.0"} + "cohttp-lwt-unix" {>= "6.0.0"} "mirage-crypto-rng" {>= "0.11.0"} "tyxml" "capnp-rpc-unix" diff --git a/web-ui/github.ml b/web-ui/github.ml index 03ee51fe..609d3dc5 100644 --- a/web-ui/github.ml +++ b/web-ui/github.ml @@ -283,10 +283,9 @@ module Repo_handle = struct (* Otherwise, an nginx reverse proxy will wait for the whole log before sending anything. *) Cohttp.Header.init_with "X-Accel-Buffering" "no" in - let res = Cohttp.Response.make ~status:`OK ~flush:true ~encoding:Cohttp.Transfer.Chunked ~headers () in + let res = Cohttp.Response.make ~status:`OK ~encoding:Cohttp.Transfer.Chunked ~headers () in let write _ic oc = - let flush = Cohttp.Response.flush res in - let writer = Transfer_IO.make_writer ~flush Cohttp.Transfer.Chunked oc in + let writer = Transfer_IO.make_writer ~flush:true Cohttp.Transfer.Chunked oc in Lwt.finalize (fun () -> stream_logs job ~owner ~name ~refs ~hash ~variant ~status chunk writer >>= fun () ->