diff --git a/.travis.yml b/.travis.yml index a2e286ffb2..18e1e2ece5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,27 +6,25 @@ install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/ma script: bash -ex ./.travis-docker.sh env: global: - - EXTRA_REMOTES="https://github.com/mirage/mirage-dev.git" - - PINS="cohttp-top:. cohttp-async:. cohttp-lwt-unix:. cohttp-lwt-jsoo:. cohttp-lwt:. cohttp-mirage:. cohttp:." + - PINS="cohttp-top.dev:. cohttp-async.dev:. cohttp-lwt-unix.dev:. cohttp-lwt-jsoo.dev:. cohttp-lwt.dev:. cohttp-mirage.dev:. cohttp.dev:." matrix: - - PACKAGE="cohttp" DISTRO="ubuntu-18.04" OCAML_VERSION="4.07" - - PACKAGE="cohttp-async" DISTRO="ubuntu-18.04" OCAML_VERSION="4.07" - - PACKAGE="cohttp-lwt-unix" DISTRO="ubuntu-18.04" OCAML_VERSION="4.07" - - PACKAGE="cohttp-lwt-jsoo" DISTRO="ubuntu-18.04" OCAML_VERSION="4.07" - - PACKAGE="cohttp-lwt" DISTRO="ubuntu-18.04" OCAML_VERSION="4.07" - - PACKAGE="cohttp-mirage" DISTRO="ubuntu-18.04" OCAML_VERSION="4.07" + - 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-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-mirage" 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-mirage" 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" diff --git a/CHANGES.md b/CHANGES.md index 48c20ada58..9a521d227d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,10 @@ +## dev + +- use conduit-mirage instead of mirage-conduit, which was renamed + upstream in conduit. The minimum OCaml version supported for + conduit-mirage is now OCaml 4.07 and higher. (@avsm) +- remove deprecation warnings in OCaml 4.08.0 using stdlib-shims (@avsm) + ## v2.1.3 (2019-07-12) - support uri.3.0.0 that has optional sexp support (#668 @avsm) diff --git a/cohttp-async.opam b/cohttp-async.opam index a4fe6a6f80..3df9fad831 100644 --- a/cohttp-async.opam +++ b/cohttp-async.opam @@ -24,18 +24,19 @@ doc: "https://mirage.github.io/ocaml-cohttp/" bug-reports: "https://github.com/mirage/ocaml-cohttp/issues" depends: [ "ocaml" {>= "4.04.1"} - "dune" {build & >= "1.1.0"} + "dune" {>= "1.1.0"} "async_kernel" {>= "v0.11.0"} "async_unix" {>= "v0.11.0"} "async_extra" {>= "v0.11.0"} "base" {>= "v0.11.0"} "core" {with-test} - "cohttp" + "cohttp" {=version} "conduit-async" {>="1.2.0"} "magic-mime" "logs" "fmt" {>= "0.8.2"} "sexplib0" + "stdlib-shims" "ppx_sexp_conv" {>= "v0.9.0"} "ounit" {with-test} "uri" {>= "2.0.0"} diff --git a/cohttp-async/bin/cohttp_curl_async.ml b/cohttp-async/bin/cohttp_curl_async.ml index 3df9c43820..0b80bfac43 100644 --- a/cohttp-async/bin/cohttp_curl_async.ml +++ b/cohttp-async/bin/cohttp_curl_async.ml @@ -31,7 +31,7 @@ let make_net_req uri meth' body () = show_headers (Cohttp.Response.headers res); body |> Body.to_pipe - |> Pipe.iter ~f:(fun b -> Caml.Pervasives.print_string b; return ()) + |> Pipe.iter ~f:(fun b -> Stdlib.print_string b; return ()) let _ = (* enable logging to stdout *) diff --git a/cohttp-lwt-jsoo.opam b/cohttp-lwt-jsoo.opam index 820c2b1530..043dc9cd4a 100644 --- a/cohttp-lwt-jsoo.opam +++ b/cohttp-lwt-jsoo.opam @@ -23,9 +23,9 @@ doc: "https://mirage.github.io/ocaml-cohttp/" bug-reports: "https://github.com/mirage/ocaml-cohttp/issues" depends: [ "ocaml" {>= "4.04.1"} - "dune" {build & >= "1.1.0"} - "cohttp" {>= "1.0.0"} - "cohttp-lwt" {>= "1.0.0"} + "dune" {>= "1.1.0"} + "cohttp" {=version} + "cohttp-lwt" {=version} "lwt" {>= "3.0.0"} "js_of_ocaml" {>= "3.3.0"} "js_of_ocaml-ppx" {>= "3.3.0"} diff --git a/cohttp-lwt-unix.opam b/cohttp-lwt-unix.opam index 8bf4c5bad9..25244d0a88 100644 --- a/cohttp-lwt-unix.opam +++ b/cohttp-lwt-unix.opam @@ -26,13 +26,13 @@ doc: "https://mirage.github.io/ocaml-cohttp/" bug-reports: "https://github.com/mirage/ocaml-cohttp/issues" depends: [ "ocaml" {>= "4.04.1"} - "dune" {build & >= "1.1.0"} + "dune" {>= "1.1.0"} "conduit-lwt-unix" {>= "1.0.3"} "cmdliner" "magic-mime" "logs" "fmt" {>= "0.8.2"} - "cohttp-lwt" + "cohttp-lwt" {=version} "lwt" {>= "3.0.0"} "base-unix" "ounit" {with-test} diff --git a/cohttp-lwt-unix/src/server.ml b/cohttp-lwt-unix/src/server.ml index 1e5e0382c5..3aea6dc1ba 100644 --- a/cohttp-lwt-unix/src/server.ml +++ b/cohttp-lwt-unix/src/server.ml @@ -60,7 +60,14 @@ let respond_file ?headers ~fname () = respond_not_found () | exn -> Lwt.fail exn) -let create ?timeout ?backlog ?stop ?on_exn ?(ctx=Net.default_ctx) +let log_on_exn = + function + | Unix.Unix_error (error, func, arg) -> + Logs.warn (fun m -> m "Client connection error %s: %s(%S)" + (Unix.error_message error) func arg) + | exn -> Logs.err (fun m -> m "Unhandled exception: %a" Fmt.exn exn) + +let create ?timeout ?backlog ?stop ?(on_exn=log_on_exn) ?(ctx=Net.default_ctx) ?(mode=`TCP (`Port 8080)) spec = - Conduit_lwt_unix.serve ?backlog ?timeout ?stop ?on_exn ~ctx:ctx.Net.ctx + Conduit_lwt_unix.serve ?backlog ?timeout ?stop ~on_exn ~ctx:ctx.Net.ctx ~mode (callback spec) diff --git a/cohttp-lwt-unix/src/server.mli b/cohttp-lwt-unix/src/server.mli index 46ff8b1bd0..8f2a8907c1 100644 --- a/cohttp-lwt-unix/src/server.mli +++ b/cohttp-lwt-unix/src/server.mli @@ -27,8 +27,8 @@ val respond_file : Every connection will be served in a new lightweight thread that is invoked via the callback defined in [t]. If the callback raises - an exception, it is passed to [on_exn] (by default, to - !Lwt.async_exception_hook). *) + an exception, it is passed to [on_exn] (by default, to a function + that logs the exceptiom using the {!Logs} library). *) val create : ?timeout:int -> ?backlog:int -> diff --git a/cohttp-lwt.opam b/cohttp-lwt.opam index f0565a4afb..7105d7f34e 100644 --- a/cohttp-lwt.opam +++ b/cohttp-lwt.opam @@ -26,8 +26,8 @@ doc: "https://mirage.github.io/ocaml-cohttp/" bug-reports: "https://github.com/mirage/ocaml-cohttp/issues" depends: [ "ocaml" {>= "4.04.1"} - "dune" {build & >= "1.1.0"} - "cohttp" {>= "1.0.0"} + "dune" {>= "1.1.0"} + "cohttp" {=version} "lwt" {>= "2.5.0"} "sexplib0" "ppx_sexp_conv" {>= "v0.9.0"} diff --git a/cohttp-mirage.opam b/cohttp-mirage.opam index a19ad1ca72..7f04156ac8 100644 --- a/cohttp-mirage.opam +++ b/cohttp-mirage.opam @@ -19,11 +19,11 @@ Please see for a self-hosted explanation and instructions on how to use this library.""" depends: [ "ocaml" {>= "4.05.0"} - "dune" {build & >= "1.1.0"} + "dune" {>= "1.1.0"} "mirage-flow-lwt" {>= "1.2.0"} "mirage-channel-lwt" {>= "3.0.0"} "conduit" {>= "0.99"} - "mirage-conduit" {>= "3.0.0"} + "conduit-mirage" "mirage-kv-lwt" {>= "2.0.0"} "lwt" {>= "2.4.3"} "cohttp" diff --git a/cohttp-mirage/src/dune b/cohttp-mirage/src/dune index 1049e946b7..9398ac5005 100644 --- a/cohttp-mirage/src/dune +++ b/cohttp-mirage/src/dune @@ -3,5 +3,5 @@ (public_name cohttp-mirage) (synopsis "Mirage backend for cohttp") (wrapped false) - (libraries cohttp-lwt mirage-channel-lwt mirage-conduit sexplib + (libraries cohttp-lwt mirage-channel-lwt conduit-mirage sexplib mirage-flow-lwt magic-mime astring)) diff --git a/cohttp-top.opam b/cohttp-top.opam index 14d0c39e73..589b97376d 100644 --- a/cohttp-top.opam +++ b/cohttp-top.opam @@ -22,8 +22,8 @@ doc: "https://mirage.github.io/ocaml-cohttp/" bug-reports: "https://github.com/mirage/ocaml-cohttp/issues" depends: [ "ocaml" {>= "4.04.1"} - "dune" {build & >= "1.1.0"} - "cohttp" + "dune" {>= "1.1.0"} + "cohttp" {=version} ] build: [ ["dune" "subst"] {pinned} diff --git a/cohttp.opam b/cohttp.opam index 0849b093c0..7f1ab64c02 100644 --- a/cohttp.opam +++ b/cohttp.opam @@ -33,7 +33,7 @@ doc: "https://mirage.github.io/ocaml-cohttp/" bug-reports: "https://github.com/mirage/ocaml-cohttp/issues" depends: [ "ocaml" {>= "4.04.1"} - "dune" {build & >= "1.1.0"} + "dune" {>= "1.1.0"} "re" {>= "1.9.0"} "uri" {>= "2.0.0"} "uri-sexp" @@ -43,6 +43,7 @@ depends: [ "ppx_sexp_conv" {>= "v0.9.0"} "stringext" "base64" {>= "3.1.0"} + "stdlib-shims" "fmt" {with-test} "jsonm" {build} "alcotest" {with-test} diff --git a/cohttp/src/connection.ml b/cohttp/src/connection.ml index ce1182e8b7..381dd67d8c 100644 --- a/cohttp/src/connection.ml +++ b/cohttp/src/connection.ml @@ -26,4 +26,4 @@ let create () = incr count; !count -let compare (a:t) (b:t) = Pervasives.compare a b +let compare (a:t) (b:t) = Stdlib.compare a b diff --git a/cohttp/src/dune b/cohttp/src/dune index 107da89505..a3a15d0701 100644 --- a/cohttp/src/dune +++ b/cohttp/src/dune @@ -10,7 +10,7 @@ (public_name cohttp) (synopsis "Co-operative Client/Server HTTP library.") (preprocess (pps ppx_fields_conv ppx_sexp_conv)) - (libraries re stringext uri uri-sexp fieldslib sexplib0 bytes base64)) + (libraries re stringext uri uri-sexp fieldslib sexplib0 bytes base64 stdlib-shims)) (ocamllex accept_lexer) (ocamlyacc accept_parser) diff --git a/cohttp/src/header.ml b/cohttp/src/header.ml index 843d160d68..dc86226aab 100644 --- a/cohttp/src/header.ml +++ b/cohttp/src/header.ml @@ -33,7 +33,7 @@ type t = string list StringMap.t let user_agent = Printf.sprintf "ocaml-cohttp/%s" Conf.version -let compare = StringMap.compare Pervasives.compare +let compare = StringMap.compare Stdlib.compare let headers_with_list_values = Array.map LString.of_string [| "accept";"accept-charset";"accept-encoding";"accept-language";