Skip to content

Commit

Permalink
Merge pull request #1003 from mseri/cohttp6-usability
Browse files Browse the repository at this point in the history
cohttp: move new client and server modules into a generic module
  • Loading branch information
mseri committed Nov 1, 2023
2 parents 6a5f05c + 59af795 commit e5a66f1
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
@@ -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
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
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
@@ -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
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
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
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
@@ -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
Expand Up @@ -76,7 +76,7 @@
(cohttp
(= :version))
(lwt
(>= 2.5.0))
(>= 5.4.0))
sexplib0
(ppx_sexp_conv
(>= v0.13.0))
Expand Down

0 comments on commit e5a66f1

Please sign in to comment.