Skip to content
This repository was archived by the owner on Dec 22, 2019. It is now read-only.
This repository was archived by the owner on Dec 22, 2019. It is now read-only.

HTTP2 Support #22

@leostera

Description

@leostera

After starting some work on this it'll require a few changes, but the overall API I'm looking forward to is:

module Httpkit = Httpkit.Make(Httpkit_lwt_unix_h2);
/* module Httpkit = Httpkit.Make(Httpkit_lwt_mirage_h2); */
/* module Httpkit = Httpkit.Make(Httpkit_lwt_unix_httpaf); */

/* Server side*/

Httpkit.Server.(
  make(App.initial_state)
  |> use(Common.log)
  |> use(App.inc)
  |> reply(App.json)
  |> Httpkit.Server.Http.listen(~port=9999, ~on_start)
/*|> Httpkit.Server.Https.TLS.listen(~port=9999, ~on_start, ~key, ~cert) */
/*|> Httpkit.Server.Https.SSL.listen(~port=9999, ~on_start, ~key, ~cert) */
  |> Lwt_main.run
);

/* Client side */
let req =
  Httpkit.Client.Request.create(
    ~headers=[("User-Agent", "Reason HttpKit")],
    `GET,
    Uri.of_string("http://api.github.com/repos/ostera/httpkit"),
  );

Httpkit.Client.(
  req
  |> Http.send
  /*|> Https.TLS.send(~config=Https.Config.from_pems(~cert, ~priv_key)) */
  /*|> Https.SSL.send(~config=Https.Config.from_pems(~cert, ~priv_key)) */
  >>= Response.body
  |> Lwt_main.run
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions