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
30 changes: 30 additions & 0 deletions git-cohttp-mirage.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
opam-version: "2.0"
maintainer: [ "thomas@gazagnaire.org"
"romain.calascibetta@gmail.com" ]
authors: "Thomas Gazagnaire"
license: "ISC"
homepage: "https://github.com/mirage/ocaml-git"
bug-reports: "https://github.com/mirage/ocaml-git/issues"
dev-repo: "git+https://github.com/mirage/ocaml-git.git"
doc: "https://mirage.github.io/ocaml-git/"
synopsis: "A package to use HTTP-based ocaml-git with MirageOS backend"

build: [
["dune" "subst"]
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j1" "--no-buffer"] {with-test}
]

depends: [
"ocaml" {>= "4.07.0"}
"dune" {>= "2.6.0"}
"git"
"cohttp-mirage"
]

pin-depends: [
[ "conduit-mirage.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
[ "cohttp.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
[ "cohttp-lwt.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
[ "cohttp-mirage.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
]
32 changes: 32 additions & 0 deletions git-cohttp-unix.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
opam-version: "2.0"
maintainer: [ "thomas@gazagnaire.org"
"romain.calascibetta@gmail.com" ]
authors: "Thomas Gazagnaire"
license: "ISC"
homepage: "https://github.com/mirage/ocaml-git"
bug-reports: "https://github.com/mirage/ocaml-git/issues"
dev-repo: "git+https://github.com/mirage/ocaml-git.git"
doc: "https://mirage.github.io/ocaml-git/"
synopsis: "A package to use HTTP-based ocaml-git with Unix backend"

build: [
["dune" "subst"]
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j1" "--no-buffer"] {with-test}
]

depends: [
"ocaml" {>= "4.07.0"}
"dune" {>= "2.6.0"}
"git"
"cohttp-lwt-unix"
]

pin-depends: [
[ "conduit.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
[ "conduit-lwt.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
[ "conduit-lwt-ssl.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
[ "cohttp.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
[ "cohttp-lwt.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
[ "cohttp-lwt-unix.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
]
27 changes: 27 additions & 0 deletions git-cohttp.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
opam-version: "2.0"
maintainer: [ "thomas@gazagnaire.org"
"romain.calascibetta@gmail.com" ]
authors: "Thomas Gazagnaire"
license: "ISC"
homepage: "https://github.com/mirage/ocaml-git"
bug-reports: "https://github.com/mirage/ocaml-git/issues"
dev-repo: "git+https://github.com/mirage/ocaml-git.git"
doc: "https://mirage.github.io/ocaml-git/"
synopsis: "A package to use HTTP-based ocaml-git with Unix backend"

build: [
["dune" "subst"]
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j1" "--no-buffer"] {with-test}
]

depends: [
"ocaml" {>= "4.07.0"}
"dune" {>= "2.6.0"}
"git"
]

pin-depends: [
[ "cohttp.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#9f19f9b8216f2546f2917b08ff227be5630858bf" ]
[ "cohttp-lwt.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#9f19f9b8216f2546f2917b08ff227be5630858bf" ]
]
8 changes: 4 additions & 4 deletions git-mirage.opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ depends: [
]

pin-depends: [
[ "conduit-mirage.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#9815aa091e9c285e236e1deffb0dc48723ac72a0" ]
[ "cohttp.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#9f19f9b8216f2546f2917b08ff227be5630858bf" ]
[ "cohttp-lwt.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#9f19f9b8216f2546f2917b08ff227be5630858bf" ]
[ "cohttp-mirage.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#9f19f9b8216f2546f2917b08ff227be5630858bf" ]
[ "conduit-mirage.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
[ "cohttp.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
[ "cohttp-lwt.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
[ "cohttp-mirage.dev" "git+https://github.com/dinosaure/ocaml-cohttp.git#11dc50bf1ee6e3df831e76ebcc25a5c9f3abc280" ]
]
4 changes: 2 additions & 2 deletions git-unix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ depends: [
]

pin-depends: [
[ "conduit.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#9815aa091e9c285e236e1deffb0dc48723ac72a0" ]
[ "conduit-lwt.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#9815aa091e9c285e236e1deffb0dc48723ac72a0" ]
[ "conduit.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
[ "conduit-lwt.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
]
2 changes: 1 addition & 1 deletion git.opam
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ depends: [
]

pin-depends: [
[ "conduit.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#9779d777cd03f85e770ecc1c1174dd382979bc58" ]
[ "conduit.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
[ "encore.dev" "git+https://github.com/mirage/encore.git#d376be363e0fb26c0c04d334931a4519a0c30878" ]
]
4 changes: 2 additions & 2 deletions nss.opam
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ depends: [
]

pin-depends: [
[ "conduit.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#9815aa091e9c285e236e1deffb0dc48723ac72a0" ]
[ "conduit-lwt.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#9815aa091e9c285e236e1deffb0dc48723ac72a0" ]
[ "conduit.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
[ "conduit-lwt.dev" "git+https://github.com/dinosaure/ocaml-conduit.git#056e94b57e6fc2a08b587e949a7c38d2f1b79e6a" ]
]
5 changes: 5 additions & 0 deletions src/git-cohttp-mirage/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(library
(name git_cohttp_mirage)
(public_name git-cohttp-mirage)
(libraries git-cohttp lwt rresult result nss.git uri fmt cohttp cohttp-lwt
cohttp-mirage))
1 change: 1 addition & 0 deletions src/git-cohttp-mirage/git_cohttp_mirage.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Git_cohttp.Make (Cohttp_mirage.Client)
1 change: 1 addition & 0 deletions src/git-cohttp-mirage/git_cohttp_mirage.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Smart_git.HTTP
5 changes: 5 additions & 0 deletions src/git-cohttp-unix/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(library
(name git_cohttp_unix)
(public_name git-cohttp-unix)
(libraries git-cohttp lwt rresult result nss.git uri fmt cohttp cohttp-lwt
cohttp-lwt-unix))
1 change: 1 addition & 0 deletions src/git-cohttp-unix/git_cohttp_unix.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Git_cohttp.Make (Cohttp_lwt_unix.Client)
1 change: 1 addition & 0 deletions src/git-cohttp-unix/git_cohttp_unix.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Smart_git.HTTP
5 changes: 2 additions & 3 deletions src/git-cohttp/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(library
(name git_cohttp)
(public_name git-mirage.cohttp)
(libraries lwt rresult result nss.git uri fmt cohttp cohttp-lwt
cohttp-mirage))
(public_name git-cohttp)
(libraries conduit lwt rresult result nss.git uri fmt cohttp cohttp-lwt))
28 changes: 16 additions & 12 deletions src/git-cohttp/git_cohttp.ml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
open Lwt.Infix

type error = |
module Make
(Cohttp_client : Cohttp_lwt.S.Client with type resolvers = Conduit.resolvers) =
struct
type error = |

let pp_error : error Fmt.t = fun _ppf -> function _ -> .
let pp_error : error Fmt.t = fun _ppf -> function _ -> .

let get ~resolvers ?(headers = []) uri =
let headers = Cohttp.Header.of_list headers in
Cohttp_mirage.Client.get ~resolvers ~headers uri >>= fun (_response, body) ->
Cohttp_lwt.Body.to_string body >>= fun body -> Lwt.return_ok ((), body)
let get ~resolvers ?(headers = []) uri =
let headers = Cohttp.Header.of_list headers in
Cohttp_client.get ~resolvers ~headers uri >>= fun (_response, body) ->
Cohttp_lwt.Body.to_string body >>= fun body -> Lwt.return_ok ((), body)

let post ~resolvers ?(headers = []) uri body =
let headers = Cohttp.Header.of_list headers in
let body = Cohttp_lwt.Body.of_string body in
Cohttp_mirage.Client.post ~resolvers ~headers ~chunked:false ~body uri
>>= fun (_response, body) ->
Cohttp_lwt.Body.to_string body >>= fun body -> Lwt.return_ok ((), body)
let post ~resolvers ?(headers = []) uri body =
let headers = Cohttp.Header.of_list headers in
let body = Cohttp_lwt.Body.of_string body in
Cohttp_client.post ~resolvers ~headers ~chunked:false ~body uri
>>= fun (_response, body) ->
Cohttp_lwt.Body.to_string body >>= fun body -> Lwt.return_ok ((), body)
end
4 changes: 3 additions & 1 deletion src/git-cohttp/git_cohttp.mli
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
include Smart_git.HTTP
module Make
(Cohttp_client : Cohttp_lwt.S.Client with type resolvers = Conduit.resolvers) :
Smart_git.HTTP