Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to cohttp 6.0.0 #335

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
(= :version))
;;
(cohttp
(>= 6.0.0~beta2))
(>= 6.0.0))
(fmt
(>= 0.9.0))
(uri
Expand Down Expand Up @@ -175,11 +175,11 @@
:with-test))
(cohttp
(and
(>= 6.0.0~beta2)
(>= 6.0.0)
:with-test))
(cohttp-lwt-unix
(and
(>= 6.0.0~beta2)
(>= 6.0.0)
(<> :os "win32")
:with-test))
(conduit-lwt-unix
Expand Down Expand Up @@ -223,7 +223,7 @@
:with-test))
(cohttp-lwt
(and
(>= 6.0.0~beta2)
(>= 6.0.0)
:with-test))
(qcheck-multicoretests-util
(and
Expand Down
12 changes: 7 additions & 5 deletions lib/picos_io_cohttp/picos_io_cohttp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ module Server = struct
let callback conn req body = `Response (callback conn req body) in
make_response_action ?conn_closed ~callback ()

let respond ?headers ?flush ~status ~body () =
let respond ?headers ~status ~body () =
let encoding =
match headers with
| None -> Cohttp.Body.transfer_encoding body
Expand All @@ -251,12 +251,12 @@ module Server = struct
| Http.Transfer.Unknown -> Cohttp.Body.transfer_encoding body
| t -> t)
in
let res = Cohttp.Response.make ~status ?flush ~encoding ?headers () in
let res = Cohttp.Response.make ~status ~encoding ?headers () in
(res, body)

let respond_string ?headers ?flush ~status ~body () =
let respond_string ?headers ~status ~body () =
let res =
Cohttp.Response.make ~status ?flush
Cohttp.Response.make ~status
~encoding:(Http.Transfer.Fixed (Int64.of_int (String.length body)))
?headers ()
in
Expand Down Expand Up @@ -288,7 +288,9 @@ module Server = struct
(if keep_alive then "keep-alive" else "close")
in
let res = { res with headers } in
Response.write (Body.write_with Response.write_body body) res oc;
Response.write ~flush:false
(Body.write_with Response.write_body body)
res oc;
if keep_alive then handle t conn ic oc
end

Expand Down
2 changes: 1 addition & 1 deletion picos_io_cohttp.opam
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bug-reports: "https://github.com/ocaml-multicore/picos/issues"
depends: [
"dune" {>= "3.14"}
"picos_io" {= version}
"cohttp" {>= "6.0.0~beta2"}
"cohttp" {>= "6.0.0"}
"fmt" {>= "0.9.0"}
"uri" {>= "4.4.0"}
"odoc" {with-doc}
Expand Down
6 changes: 3 additions & 3 deletions picos_meta.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ depends: [
"qcheck-stm" {>= "0.3"}
"alcotest" {>= "1.7.0" & with-test}
"backoff" {>= "0.1.0" & with-test}
"cohttp" {>= "6.0.0~beta2" & with-test}
"cohttp-lwt-unix" {>= "6.0.0~beta2" & os != "win32" & with-test}
"cohttp" {>= "6.0.0" & with-test}
"cohttp-lwt-unix" {>= "6.0.0" & os != "win32" & with-test}
"conduit-lwt-unix" {>= "6.2.2" & os != "win32" & with-test}
"conf-npm"
{arch != "x86_32" & arch != "riscv64" & os != "win32" & with-test}
Expand All @@ -34,7 +34,7 @@ depends: [
"multicore-magic" {>= "2.3.0" & with-test}
"multicore-magic-dscheck" {>= "2.3.0" & with-test}
"ocaml-version" {>= "3.6.4" & with-test}
"cohttp-lwt" {>= "6.0.0~beta2" & with-test}
"cohttp-lwt" {>= "6.0.0" & with-test}
"qcheck-multicoretests-util" {>= "0.3" & with-test}
"uri" {>= "4.4.0" & with-test}
"odoc" {>= "2.4.1" & with-doc}
Expand Down