Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP/2 types for h2-mirage #978

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/mirage/mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ let cohttp_server = Mirage_impl_http.cohttp_server

let httpaf_server = Mirage_impl_http.httpaf_server

type http2 = Mirage_impl_http.http2

let http2 = Mirage_impl_http.http2

let http2_server = Mirage_impl_http.http2_server

type argv = Functoria.argv

let argv = Functoria.argv
Expand Down
9 changes: 8 additions & 1 deletion lib/mirage/mirage.mli
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ val conduit : conduit typ

val conduit_direct : ?tls:bool -> stackv4 impl -> conduit impl

(** {2 HTTP configuration} *)
(** {2 HTTP/1 configuration} *)

type http

Expand All @@ -533,6 +533,13 @@ val cohttp_server : conduit impl -> http impl
val httpaf_server : conduit impl -> http impl
(** [httpaf_server] starts a http/af server. *)

(** {2 HTTP/2 configuration} *)
type http2

val http2: http2 typ

val http2_server: conduit impl -> http2 impl

(** {2 Argv configuration} *)

type argv = Functoria.argv
Expand Down
12 changes: 11 additions & 1 deletion lib/mirage/mirage_impl_http.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ type http = HTTP

let http = Type.v HTTP

type http2 = HTTP2

let http2 = Type.v HTTP2

let connect err _i modname = function
| [ conduit ] -> Fmt.strf "%s.connect %s" modname conduit
| _ -> failwith (connect_err err 1)
Expand All @@ -18,5 +22,11 @@ let cohttp_server conduit =
let httpaf_server conduit =
let packages = [ package "httpaf-mirage" ] in
let extra_deps = [ abstract conduit ] in
impl ~packages ~connect:(connect "httapf") ~extra_deps
impl ~packages ~connect:(connect "httpaf") ~extra_deps
"Httpaf_mirage.Server_with_conduit" http

let http2_server conduit =
let packages = [ package "h2-mirage" ] in
let extra_deps = [ abstract conduit ] in
impl ~packages ~connect:(connect "h2") ~extra_deps
"H2_mirage.Server_with_conduit" http2
7 changes: 7 additions & 0 deletions lib/mirage/mirage_impl_http.mli
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ val cohttp_server :

val httpaf_server :
Mirage_impl_conduit.conduit Functoria.impl -> http Functoria.impl

type http2

val http2 : http2 Functoria.typ

val http2_server :
Mirage_impl_conduit.conduit Functoria.impl -> http2 Functoria.impl