From 2f0a313e9a52876cb2b7a34c1baa7567510f5c0a Mon Sep 17 00:00:00 2001 From: Thomas Gazagnaire Date: Wed, 4 Mar 2015 14:43:52 +0000 Subject: [PATCH] Simplify the Net signature which needs to be provided for lwt servers --- lwt/cohttp_lwt.ml | 8 +------- lwt/cohttp_lwt.mli | 7 +------ lwt/cohttp_lwt_unix.ml | 7 +++---- lwt/cohttp_lwt_unix.mli | 1 - 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/lwt/cohttp_lwt.ml b/lwt/cohttp_lwt.ml index fa1b02d25d..15c9cf2797 100644 --- a/lwt/cohttp_lwt.ml +++ b/lwt/cohttp_lwt.ml @@ -219,9 +219,6 @@ module type Server = sig module Request : Request module Response : Response - type ctx with sexp_of - val default_ctx : ctx - type conn = IO.conn * Cohttp.Connection.t type t @@ -268,14 +265,11 @@ end module Make_server(IO:IO) (Request:Request with module IO=IO) (Response:Response with module IO=IO) - (Net:Net with module IO=IO) = struct += struct module IO = IO module Request = Request module Response = Response - type ctx = Net.ctx with sexp_of - let default_ctx = Net.default_ctx - type conn = IO.conn * Cohttp.Connection.t type t = { diff --git a/lwt/cohttp_lwt.mli b/lwt/cohttp_lwt.mli index 8809508a38..64d980b0bf 100644 --- a/lwt/cohttp_lwt.mli +++ b/lwt/cohttp_lwt.mli @@ -163,9 +163,6 @@ module type Server = sig module Request : Request module Response : Response - type ctx with sexp_of - val default_ctx : ctx - type conn = IO.conn * Cohttp.Connection.t type t @@ -225,8 +222,6 @@ module Make_server (IO:IO) (Request:Request with module IO=IO) (Response:Response with module IO=IO) - (Net:Net with module IO = IO) : - Server with module IO = IO + : Server with module IO = IO and module Request = Request and module Response = Response - and type ctx = Net.ctx diff --git a/lwt/cohttp_lwt_unix.ml b/lwt/cohttp_lwt_unix.ml index 268bb1b682..8a6982e35b 100644 --- a/lwt/cohttp_lwt_unix.ml +++ b/lwt/cohttp_lwt_unix.ml @@ -37,8 +37,8 @@ module Client = struct let custom_ctx = Cohttp_lwt_unix_net.custom_ctx end -module Server_core = Cohttp_lwt.Make_server - (Cohttp_lwt_unix_io)(Request)(Response)(Cohttp_lwt_unix_net) +module Server_core = + Cohttp_lwt.Make_server (Cohttp_lwt_unix_io)(Request)(Response) module Server = struct include Server_core @@ -86,7 +86,7 @@ module Server = struct let body = Printexc.to_string exn in respond_error ~status:`Internal_server_error ~body () - let create ?timeout ?stop ?(ctx=default_ctx) ?(mode=`TCP (`Port 8080)) spec = + let create ?timeout ?stop ?(ctx=Cohttp_lwt_unix_net.default_ctx) ?(mode=`TCP (`Port 8080)) spec = Conduit_lwt_unix.serve ?timeout ?stop ~ctx:ctx.Cohttp_lwt_unix_net.ctx ~mode (fun conn ic oc -> (callback spec) conn ic oc) end @@ -96,7 +96,6 @@ module type S = sig include Cohttp_lwt.Server with module IO = Cohttp_lwt_unix_io and module Request = Request and module Response = Response - and type ctx = Cohttp_lwt_unix_net.ctx val resolve_file : docroot:string -> uri:Uri.t -> string diff --git a/lwt/cohttp_lwt_unix.mli b/lwt/cohttp_lwt_unix.mli index 99e368ecc8..4d393175a6 100644 --- a/lwt/cohttp_lwt_unix.mli +++ b/lwt/cohttp_lwt_unix.mli @@ -63,7 +63,6 @@ module type S = sig include Cohttp_lwt.Server with module IO = Cohttp_lwt_unix_io and module Request = Request and module Response = Response - and type ctx = Cohttp_lwt_unix_net.ctx val resolve_file : docroot:string -> uri:Uri.t -> string