diff --git a/.travis.yml b/.travis.yml index 18e1e2ece5..0dcc7ae242 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,30 +10,28 @@ env: matrix: - PACKAGE="cohttp" DISTRO="ubuntu-lts" OCAML_VERSION="4.08" DEPOPTS="cohttp-async cohttp-lwt-unix cohttp-mirage" - PACKAGE="cohttp" DISTRO="ubuntu-lts" OCAML_VERSION="4.07" - - PACKAGE="cohttp-async" DISTRO="ubuntu-lts" OCAML_VERSION="4.07" + - PACKAGE="cohttp-async" DISTRO="ubuntu-lts" OCAML_VERSION="4.08" + - PACKAGE="cohttp-async" DISTRO="alpine" OCAML_VERSION="4.08" + - PACKAGE="cohttp-async" DISTRO="debian-unstable" OCAML_VERSION="4.08" + - PACKAGE="cohttp-async" DISTRO="ubuntu-16.04" OCAML_VERSION="4.08" - PACKAGE="cohttp-lwt-unix" DISTRO="ubuntu-lts" OCAML_VERSION="4.07" - PACKAGE="cohttp-lwt-jsoo" DISTRO="ubuntu-lts" OCAML_VERSION="4.07" - PACKAGE="cohttp-lwt" DISTRO="ubuntu-lts" OCAML_VERSION="4.07" - PACKAGE="cohttp-mirage" DISTRO="alpine" OCAML_VERSION="4.07" - PACKAGE="cohttp" DISTRO="alpine" OCAML_VERSION="4.06" - - PACKAGE="cohttp-async" DISTRO="alpine" OCAML_VERSION="4.06" - PACKAGE="cohttp-lwt-unix" DISTRO="alpine" OCAML_VERSION="4.06" - PACKAGE="cohttp-lwt-jsoo" DISTRO="alpine" OCAML_VERSION="4.06" - PACKAGE="cohttp-lwt" DISTRO="alpine" OCAML_VERSION="4.06" - PACKAGE="cohttp" DISTRO="debian-unstable" OCAML_VERSION="4.05" - - PACKAGE="cohttp-async" DISTRO="debian-unstable" OCAML_VERSION="4.05" - PACKAGE="cohttp-lwt-unix" DISTRO="debian-unstable" OCAML_VERSION="4.05" - PACKAGE="cohttp-lwt-jsoo" DISTRO="debian-unstable" OCAML_VERSION="4.05" - PACKAGE="cohttp-lwt" DISTRO="debian-unstable" OCAML_VERSION="4.05" - PACKAGE="cohttp" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04" - - PACKAGE="cohttp-async" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04" - PACKAGE="cohttp-lwt-unix" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04" - PACKAGE="cohttp-lwt-jsoo" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04" - PACKAGE="cohttp-lwt" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04" matrix: allow_failures: - - env: PACKAGE="cohttp-async" DISTRO="alpine" OCAML_VERSION="4.06" - - env: PACKAGE="cohttp-async" DISTRO="debian-unstable" OCAML_VERSION="4.05" - env: PACKAGE="cohttp-lwt-unix" DISTRO="debian-unstable" OCAML_VERSION="4.05" notifications: diff --git a/cohttp-async.opam b/cohttp-async.opam index 3df9fad831..ca68676306 100644 --- a/cohttp-async.opam +++ b/cohttp-async.opam @@ -25,9 +25,9 @@ bug-reports: "https://github.com/mirage/ocaml-cohttp/issues" depends: [ "ocaml" {>= "4.04.1"} "dune" {>= "1.1.0"} - "async_kernel" {>= "v0.11.0"} - "async_unix" {>= "v0.11.0"} - "async_extra" {>= "v0.11.0"} + "async_kernel" {>= "v0.13.0"} + "async_unix" {>= "v0.13.0"} + "async" {>= "v0.13.0"} "base" {>= "v0.11.0"} "core" {with-test} "cohttp" {=version} @@ -37,7 +37,7 @@ depends: [ "fmt" {>= "0.8.2"} "sexplib0" "stdlib-shims" - "ppx_sexp_conv" {>= "v0.9.0"} + "ppx_sexp_conv" {>= "v0.13.0"} "ounit" {with-test} "uri" {>= "2.0.0"} "uri-sexp" diff --git a/cohttp-async/bin/cohttp_curl_async.ml b/cohttp-async/bin/cohttp_curl_async.ml index 0b80bfac43..cd634f945b 100644 --- a/cohttp-async/bin/cohttp_curl_async.ml +++ b/cohttp-async/bin/cohttp_curl_async.ml @@ -38,7 +38,7 @@ let _ = Fmt_tty.setup_std_outputs (); Logs.set_level @@ Some Logs.Debug; Logs.set_reporter (Logs_fmt.reporter ()); - let open Async_extra.Command in + let open Async_command in async_spec ~summary:"Fetch URL and print it" Spec.( empty diff --git a/cohttp-async/bin/cohttp_server_async.ml b/cohttp-async/bin/cohttp_server_async.ml index b544a0b937..f7cb243163 100644 --- a/cohttp-async/bin/cohttp_server_async.ml +++ b/cohttp-async/bin/cohttp_server_async.ml @@ -121,12 +121,12 @@ let start_server docroot port index cert_file key_file verbose () = Logs.err (fun f -> f "Error from %s" (Socket.Address.to_string addr)); Logs.err (fun f -> f "%s" @@ Exn.to_string exn))) ~mode - (Async_extra.Tcp.Where_to_listen.of_port port) + (Tcp.Where_to_listen.of_port port) (handler ~info ~docroot ~index) >>= fun _serv -> Deferred.never () let () = - let open Async_extra.Command in + let open Async_command in run @@ async_spec ~summary:"Serve the local directory contents via HTTP or HTTPS" Spec.( diff --git a/cohttp-async/bin/dune b/cohttp-async/bin/dune index 43207b71e2..5c06d2b461 100644 --- a/cohttp-async/bin/dune +++ b/cohttp-async/bin/dune @@ -2,5 +2,5 @@ (names cohttp_curl_async cohttp_server_async) (package cohttp-async) (public_names cohttp-curl-async cohttp-server-async) - (libraries cohttp-async async_kernel async_extra async_unix base + (libraries cohttp-async async_kernel async.async_command async_unix base cohttp cohttp_server fmt.tty)) diff --git a/cohttp-async/src/dune b/cohttp-async/src/dune index e772076216..1b2500a30f 100644 --- a/cohttp-async/src/dune +++ b/cohttp-async/src/dune @@ -2,6 +2,6 @@ (name cohttp_async) (synopsis "Async backend") (public_name cohttp-async) - (libraries logs.fmt base fmt async_unix async_kernel async_extra uri + (libraries logs.fmt base fmt async_unix async_kernel uri uri.services uri-sexp ipaddr.unix conduit-async magic-mime cohttp) (preprocess (pps ppx_sexp_conv))) diff --git a/cohttp-async/src/server.ml b/cohttp-async/src/server.ml index 9f4069e544..4e53317b1d 100644 --- a/cohttp-async/src/server.ml +++ b/cohttp-async/src/server.ml @@ -1,7 +1,6 @@ open Base open Async_kernel open Async_unix -open Async_extra module Request = struct include Cohttp.Request @@ -14,7 +13,7 @@ module Response = struct end type ('address, 'listening_on) t = { - server: ('address, 'listening_on) Tcp.Server.t sexp_opaque; + server: ('address, 'listening_on) Tcp.Server.t [@sexp.opaque]; } [@@deriving sexp_of] type response = Response.t * Body.t [@@deriving sexp_of] diff --git a/cohttp-async/src/server.mli b/cohttp-async/src/server.mli index ebc584a386..17b606870e 100644 --- a/cohttp-async/src/server.mli +++ b/cohttp-async/src/server.mli @@ -74,7 +74,7 @@ val create_expert : on_handler_error:[ `Call of 'address -> exn -> unit | `Ignore | `Raise ] -> - ('address, 'listening_on) Async_extra.Tcp.Where_to_listen.t + ('address, 'listening_on) Async.Tcp.Where_to_listen.t -> (body:Body.t -> 'address -> Request.t -> response_action Async_kernel.Deferred.t) -> ('address, 'listening_on) t Async_kernel.Deferred.t @@ -89,6 +89,6 @@ val create : on_handler_error:[ `Call of 'address -> exn -> unit | `Ignore | `Raise ] -> - ('address, 'listening_on) Async_extra.Tcp.Where_to_listen.t + ('address, 'listening_on) Async.Tcp.Where_to_listen.t -> (body:Body.t -> 'address -> Request.t -> response Async_kernel.Deferred.t) -> ('address, 'listening_on) t Async_kernel.Deferred.t diff --git a/cohttp-lwt.opam b/cohttp-lwt.opam index 7105d7f34e..ada5ae61f8 100644 --- a/cohttp-lwt.opam +++ b/cohttp-lwt.opam @@ -30,7 +30,7 @@ depends: [ "cohttp" {=version} "lwt" {>= "2.5.0"} "sexplib0" - "ppx_sexp_conv" {>= "v0.9.0"} + "ppx_sexp_conv" {>= "v0.13.0"} "logs" ] build: [ diff --git a/cohttp-lwt/src/body.ml b/cohttp-lwt/src/body.ml index 037500f3a2..0550280066 100644 --- a/cohttp-lwt/src/body.ml +++ b/cohttp-lwt/src/body.ml @@ -16,11 +16,10 @@ open Cohttp open Lwt -open Sexplib0.Sexp_conv type t = [ | Body.t - | `Stream of string Lwt_stream.t sexp_opaque + | `Stream of (string Lwt_stream.t [@sexp.opaque]) ] [@@deriving sexp] let empty = (Body.empty :> t) diff --git a/cohttp.opam b/cohttp.opam index 7f1ab64c02..a4df15e1cb 100644 --- a/cohttp.opam +++ b/cohttp.opam @@ -40,7 +40,7 @@ depends: [ "fieldslib" "sexplib0" "ppx_fields_conv" {>= "v0.9.0"} - "ppx_sexp_conv" {>= "v0.9.0"} + "ppx_sexp_conv" {>= "v0.13.0"} "stringext" "base64" {>= "3.1.0"} "stdlib-shims" diff --git a/cohttp_async_test/src/cohttp_async_test.ml b/cohttp_async_test/src/cohttp_async_test.ml index d66c7ccd9e..b40fe0e628 100644 --- a/cohttp_async_test/src/cohttp_async_test.ml +++ b/cohttp_async_test/src/cohttp_async_test.ml @@ -29,7 +29,7 @@ let temp_server ?port spec callback = | Some p -> p in let uri = Uri.of_string ("http://0.0.0.0:" ^ (Int.to_string port)) in let server = Server.create_expert ~on_handler_error:`Raise - (Async_extra.Tcp.Where_to_listen.of_port port) + (Async.Tcp.Where_to_listen.of_port port) (fun ~body _sock req -> spec req body) in server >>= fun server -> callback uri >>= fun res -> diff --git a/cohttp_async_test/src/dune b/cohttp_async_test/src/dune index a359c44735..0c77334d59 100644 --- a/cohttp_async_test/src/dune +++ b/cohttp_async_test/src/dune @@ -1,5 +1,4 @@ (library (name cohttp_async_test) (wrapped false) - (libraries fmt.tty uri.services async_kernel async_extra cohttp_test - cohttp-async)) + (libraries fmt.tty uri.services async_kernel cohttp_test cohttp-async)) diff --git a/examples/async/dune b/examples/async/dune index 7ffe849e58..78c2522519 100644 --- a/examples/async/dune +++ b/examples/async/dune @@ -1,6 +1,6 @@ (executables (names hello_world receive_post) - (libraries cohttp-async async_extra base async_kernel)) + (libraries cohttp-async base async_kernel)) (alias (name runtest) diff --git a/examples/async/hello_world.ml b/examples/async/hello_world.ml index 19dd4ec9ef..b566fb6646 100644 --- a/examples/async/hello_world.ml +++ b/examples/async/hello_world.ml @@ -23,11 +23,11 @@ let start_server port () = Caml.Printf.eprintf "Listening for HTTP on port %d\n" port; Caml.Printf.eprintf "Try 'curl http://localhost:%d/test?hello=xyz'\n%!" port; Cohttp_async.Server.create ~on_handler_error:`Raise - (Async_extra.Tcp.Where_to_listen.of_port port) handler + (Async.Tcp.Where_to_listen.of_port port) handler >>= fun _ -> Deferred.never () let () = - let module Command = Async_extra.Command in + let module Command = Async_command in Command.async_spec ~summary:"Start a hello world Async server" Command.Spec.( diff --git a/examples/async/receive_post.ml b/examples/async/receive_post.ml index f5ff5bd2e0..91ef78b918 100644 --- a/examples/async/receive_post.ml +++ b/examples/async/receive_post.ml @@ -9,7 +9,7 @@ let start_server port () = Caml.Printf.eprintf "Listening for HTTP on port %d\n" port; Caml.Printf.eprintf "Try 'curl -X POST -d 'foo bar' http://localhost:%d\n" port; Cohttp_async.Server.create ~on_handler_error:`Raise - (Async_extra.Tcp.Where_to_listen.of_port port) (fun ~body _ req -> + (Async.Tcp.Where_to_listen.of_port port) (fun ~body _ req -> match req |> Cohttp.Request.meth with | `POST -> (Body.to_string body) >>= (fun body -> @@ -20,7 +20,7 @@ let start_server port () = >>= fun _ -> Deferred.never () let () = - let module Command = Async_extra.Command in + let module Command = Async_command in Command.async_spec ~summary:"Simple http server that outputs body of POST's" Command.Spec.(empty +>