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

Fix examples #160

Merged
merged 1 commit into from Feb 18, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/alpn/lib/http1_handler.ml
Expand Up @@ -12,12 +12,12 @@ let redirect_handler : Unix.sockaddr -> Reqd.t Gluten.reqd -> unit =
Reqd.respond_with_string reqd response ""

let redirect_error_handler
: Unix.sockaddr -> ?request:Request.t -> _
-> (Headers.t -> [ `write ] Body.t) -> unit
: Unix.sockaddr -> ?request:Request.t -> _ -> (Headers.t -> Body.Writer.t)
-> unit
=
fun _client_address ?request:_ _error start_response ->
let response_body = start_response Headers.empty in
Body.close_writer response_body
Body.Writer.close response_body

let request_handler : Unix.sockaddr -> Reqd.t Gluten.reqd -> unit =
fun _client_address { Gluten.reqd; _ } ->
Expand All @@ -42,9 +42,9 @@ let request_handler : Unix.sockaddr -> Reqd.t Gluten.reqd -> unit =
Reqd.respond_with_string reqd response response_body

let error_handler
: Unix.sockaddr -> ?request:Request.t -> _
-> (Headers.t -> [ `write ] Body.t) -> unit
: Unix.sockaddr -> ?request:Request.t -> _ -> (Headers.t -> Body.Writer.t)
-> unit
=
fun _client_address ?request:_ _error start_response ->
let response_body = start_response Headers.empty in
Body.close_writer response_body
Body.Writer.close response_body
8 changes: 4 additions & 4 deletions examples/alpn/unix/alpn_server_tls.ml
Expand Up @@ -40,8 +40,8 @@ let start_https_server () =
X509_lwt.private_of_pems ~cert ~priv_key >>= fun certificate ->
let config =
Tls.Config.server
~alpn_protocols:
[ "h2"; "http/1.1" ] (* accept h2 before http/1.1 *)
~alpn_protocols:[ "h2"; "http/1.1" ]
(* accept h2 before http/1.1 *)
~certificates:(`Single certificate)
~ciphers:
(List.filter
Expand All @@ -51,10 +51,10 @@ let start_https_server () =
in
Tls_lwt.Unix.server_of_fd config fd >>= fun tls_server ->
match Tls_lwt.Unix.epoch tls_server with
| `Error ->
| Error () ->
Lwt_io.eprintlf
"Unable to fetch session data. Did the handshake fail?"
| `Ok { alpn_protocol; _ } ->
| Ok { alpn_protocol; _ } ->
(match alpn_protocol with
| None ->
(* Unable to negotiate a protocol *)
Expand Down
4 changes: 2 additions & 2 deletions examples/lwt/lwt_h2c.ml
Expand Up @@ -103,8 +103,8 @@ let connection_handler =
Status.to_string error
in
let body = handle Headers.empty in
Body.write_string body message;
Body.close_writer body
Body.Writer.write_string body message;
Body.Writer.close body
in
let request_handler _addr (reqd : Httpaf.Reqd.t Gluten.reqd) =
let { Gluten.reqd; upgrade } = reqd in
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.