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

Pass alpn_protocols to the gluten_lwt_unix runtime #65

Merged
merged 1 commit into from
May 9, 2020
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
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