Skip to content

Commit

Permalink
Pass alpn_protocols to the gluten_lwt_unix runtime (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed May 11, 2020
1 parent e73ccf4 commit fbca566
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 0 additions & 2 deletions lib/respd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ let create error_handler request request_body writer response_handler =

let request { request; _ } = request

let request_body { request_body; _ } = request_body

let write_request t =
Writer.write_request t.writer t.request;
t.state <- Awaiting_response
Expand Down
16 changes: 12 additions & 4 deletions lwt-unix/httpaf_lwt_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ module Server = struct
Gluten_lwt_unix.Server.TLS.create_default ~certfile ~keyfile
in
fun client_addr socket ->
make_tls_server client_addr socket >>= fun tls_server ->
make_tls_server client_addr ~alpn_protocols:["http/1.1"] socket
>>= fun tls_server ->
create_connection_handler
?config
~request_handler
Expand All @@ -73,7 +74,8 @@ module Server = struct
Gluten_lwt_unix.Server.SSL.create_default ~certfile ~keyfile
in
fun client_addr socket ->
make_ssl_server client_addr socket >>= fun ssl_server ->
make_ssl_server ~alpn_protocols:["http/1.1"] client_addr socket
>>= fun ssl_server ->
create_connection_handler
?config
~request_handler
Expand All @@ -90,15 +92,21 @@ module Client = struct
include Httpaf_lwt.Client (Gluten_lwt_unix.Client.TLS)

let create_connection_with_default ?config socket =
Gluten_lwt_unix.Client.TLS.create_default socket >>= fun tls_client ->
Gluten_lwt_unix.Client.TLS.create_default
~alpn_protocols:["http/1.1"]
socket
>>= fun tls_client ->
create_connection ?config tls_client
end

module SSL = struct
include Httpaf_lwt.Client (Gluten_lwt_unix.Client.SSL)

let create_connection_with_default ?config socket =
Gluten_lwt_unix.Client.SSL.create_default socket >>= fun ssl_client ->
Gluten_lwt_unix.Client.SSL.create_default
~alpn_protocols:["http/1.1"]
socket
>>= fun ssl_client ->
create_connection ?config ssl_client
end
end
7 changes: 3 additions & 4 deletions nix/sources.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{ ocamlVersion ? "4_10" }:

let
overlays = builtins.fetchTarball {
url = https://github.com/anmonteiro/nix-overlays/archive/7d2957f.tar.gz;
sha256 = "03bklfgq21d4xyv564rwjdml3rv97a5igv0s7h7f9jnydv6ayhqp";
};
overlays =
builtins.fetchTarball
https://github.com/anmonteiro/nix-overlays/archive/03ecae5.tar.gz;

in

Expand Down

0 comments on commit fbca566

Please sign in to comment.