Skip to content
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
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions cohttp-async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cohttp-async/bin/cohttp_curl_async.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cohttp-async/bin/cohttp_server_async.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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.(
Expand Down
2 changes: 1 addition & 1 deletion cohttp-async/bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion cohttp-async/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
3 changes: 1 addition & 2 deletions cohttp-async/src/server.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
open Base
open Async_kernel
open Async_unix
open Async_extra

module Request = struct
include Cohttp.Request
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions cohttp-async/src/server.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion cohttp-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
3 changes: 1 addition & 2 deletions cohttp-lwt/src/body.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cohttp.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cohttp_async_test/src/cohttp_async_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
3 changes: 1 addition & 2 deletions cohttp_async_test/src/dune
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 1 addition & 1 deletion examples/async/dune
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions examples/async/hello_world.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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.(
Expand Down
4 changes: 2 additions & 2 deletions examples/async/receive_post.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand All @@ -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 +>
Expand Down