diff --git a/lwt-unix/httpaf_lwt_unix.ml b/lwt-unix/httpaf_lwt_unix.ml index 9dc7f1db..5fa579f4 100644 --- a/lwt-unix/httpaf_lwt_unix.ml +++ b/lwt-unix/httpaf_lwt_unix.ml @@ -171,6 +171,7 @@ module Server = struct ?(config=Config.default) ~request_handler ~error_handler = + let make_tls_server = Tls_io.make_server ?server ?certfile ?keyfile in fun client_addr socket -> let connection = Server_connection.create @@ -178,7 +179,7 @@ module Server = struct ~error_handler:(error_handler client_addr) (request_handler client_addr) in - Tls_io.make_server ?server ?certfile ?keyfile socket >>= fun tls_server -> + make_tls_server socket >>= fun tls_server -> let readf = Tls_io.readf tls_server in let writev = Tls_io.writev tls_server in start_read_write_loops ~config ~readf ~writev ~socket connection @@ -193,6 +194,7 @@ module Server = struct ?(config=Config.default) ~request_handler ~error_handler = + let make_ssl_server = Ssl_io.make_server ?server ?certfile ?keyfile in fun client_addr socket -> let connection = Server_connection.create @@ -200,7 +202,7 @@ module Server = struct ~error_handler:(error_handler client_addr) (request_handler client_addr) in - Ssl_io.make_server ?server ?certfile ?keyfile socket >>= fun tls_server -> + make_ssl_server socket >>= fun tls_server -> let readf = Ssl_io.readf tls_server in let writev = Ssl_io.writev tls_server in start_read_write_loops ~config ~readf ~writev ~socket connection diff --git a/lwt-unix/ssl_io_dummy.ml b/lwt-unix/ssl_io_dummy.ml index eb56f5ee..e438aa0e 100644 --- a/lwt-unix/ssl_io_dummy.ml +++ b/lwt-unix/ssl_io_dummy.ml @@ -9,8 +9,10 @@ let writev _socket _fd = type client = [ `Ssl_not_available ] type server = [ `Ssl_not_available ] -let make_client ?client:_ _socket = - Lwt.fail_with "Ssl not available" +let[@ocaml.warning "-21"] make_client ?client:_ = + failwith "Ssl not available"; + fun _socket -> Lwt.fail_with "Ssl not available" -let make_server ?server:_ ?certfile:_ ?keyfile:_ _socket = - Lwt.fail_with "Ssl not available" +let[@ocaml.warning "-21"] make_server ?server:_ ?certfile:_ ?keyfile:_ = + failwith "Ssl not available"; + fun _socket -> Lwt.fail_with "Ssl not available" diff --git a/lwt-unix/tls_io_dummy.ml b/lwt-unix/tls_io_dummy.ml index d3eb8f23..231458db 100644 --- a/lwt-unix/tls_io_dummy.ml +++ b/lwt-unix/tls_io_dummy.ml @@ -9,8 +9,10 @@ let writev _tls _fd = type client = [ `Tls_not_available ] type server = [ `Tls_not_available ] -let make_client ?client:_ _socket = - Lwt.fail_with "Tls not available" +let[@ocaml.warning "-21"] make_client ?client:_ = + failwith "TLS not available"; + fun _socket -> Lwt.return `Tls_not_available -let make_server ?server:_ ?certfile:_ ?keyfile:_ _socket = - Lwt.fail_with "Tls not available" +let[@ocaml.warning "-21"] make_server ?server:_ ?certfile:_ ?keyfile:_ = + failwith "TLS not available"; + fun _socket -> Lwt.fail_with "TLS not available"