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

cohttp: move new client and server modules into a generic module #1003

Merged
merged 2 commits into from
Nov 1, 2023
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## v6.0.0~beta1 (2023-10-27)
- cohttp-eio: move new Cohttp.{Client,Server} modules under Cohttp.Generic (mseri #1003)
- cohttp-eio: Add Client.make_generic and HTTPS support. (talex5 #1002)
- cohttp: move generic client and server signatures to cohttp and use them across all packges. (mefyl #984)
- cohttp-eio: Complete rewrite to follow common interfaces and behaviors. (mefyl #984)
Expand Down
2 changes: 1 addition & 1 deletion cohttp-eio/src/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type connection = Eio.Flow.two_way_ty r
type t = sw:Switch.t -> Uri.t -> connection

include
Cohttp.Client.Make
Cohttp.Generic.Client.Make
(struct
type 'a io = 'a
type body = Body.t
Expand Down
2 changes: 1 addition & 1 deletion cohttp-eio/src/client.mli
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Eio.Std
type t

include
Cohttp.Client.S
Cohttp.Generic.Client.S
with type 'a with_context = t -> sw:Switch.t -> 'a
and type 'a io = 'a
and type body = Body.t
Expand Down
2 changes: 1 addition & 1 deletion cohttp-eio/src/server.mli
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include Cohttp.Server.S with module IO = Io.IO and type body = Body.t
include Cohttp.Generic.Server.S with module IO = Io.IO and type body = Body.t

val run :
?max_connections:int ->
Expand Down
2 changes: 1 addition & 1 deletion cohttp-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ depends: [
"ocaml" {>= "4.08"}
"http" {= version}
"cohttp" {= version}
"lwt" {>= "2.5.0"}
"lwt" {>= "5.4.0"}
"sexplib0"
"ppx_sexp_conv" {>= "v0.13.0"}
"logs"
Expand Down
2 changes: 1 addition & 1 deletion cohttp-lwt/src/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Make (Connection : S.Connection) = struct
| Some ctx -> No_cache.(call (create ~ctx ()))

include
Cohttp.Client.Make
Cohttp.Generic.Client.Make
(struct
type 'a io = 'a Lwt.t
type body = Body.t
Expand Down
4 changes: 2 additions & 2 deletions cohttp-lwt/src/s.ml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ module type Client = sig
interface rather than invoke this function directly. See {!head}, {!get}
and {!post} for some examples. *)
include
Cohttp.Client.S
Cohttp.Generic.Client.S
with type 'a io = 'a Lwt.t
and type body = Body.t
and type 'a with_context = ?ctx:ctx -> 'a
Expand All @@ -223,7 +223,7 @@ end

(** The [Server] module implements a pipelined HTTP/1.1 server. *)
module type Server = sig
include Cohttp.Server.S with type body = Body.t and type 'a IO.t = 'a Lwt.t
include Cohttp.Generic.Server.S with type body = Body.t and type 'a IO.t = 'a Lwt.t

val resolve_local_file : docroot:string -> uri:Uri.t -> string
[@@deprecated "Please use Cohttp.Path.resolve_local_file. "]
Expand Down
7 changes: 5 additions & 2 deletions cohttp/src/cohttp.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module Accept = Accept
module Auth = Auth
module Body = Body
module Client = Client
module Conf = Conf
module Connection = Connection [@@deprecated "Connection.t values are useless."]
module Code = Code
Expand All @@ -11,10 +10,14 @@ module Link = Link
module Request = Request
module Response = Response
module S = S
module Server = Server
module Path = Path
module Transfer = Transfer

module Generic = struct
module Client = Client
module Server = Server
end

module Private = struct
module Transfer_io = Transfer_io
module String_io = String_io
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
(cohttp
(= :version))
(lwt
(>= 2.5.0))
(>= 5.4.0))
sexplib0
(ppx_sexp_conv
(>= v0.13.0))
Expand Down
Loading