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

conduit-lwt-unix: do not use directly the Ssl module #418

Merged
merged 1 commit into from
Dec 15, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/conduit-lwt-unix/conduit_lwt_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type ctx = {
tls_own_key : tls_own_key;
tls_authenticator : Conduit_lwt_tls.X509.authenticator;
ssl_client_verify : Conduit_lwt_unix_ssl.Client.verify;
ssl_ctx : Ssl.context;
ssl_ctx : Conduit_lwt_unix_ssl.Client.context;
}

let string_of_unix_sockaddr sa =
Expand Down
2 changes: 1 addition & 1 deletion src/conduit-lwt-unix/conduit_lwt_unix.mli
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ val init :
?src:string ->
?tls_own_key:tls_own_key ->
?tls_authenticator:Conduit_lwt_tls.X509.authenticator ->
?ssl_ctx:Ssl.context ->
?ssl_ctx:Conduit_lwt_unix_ssl.Client.context ->
?ssl_client_verify:Conduit_lwt_unix_ssl.Client.verify ->
unit ->
ctx io
Expand Down
5 changes: 4 additions & 1 deletion src/conduit-lwt-unix/conduit_lwt_unix_ssl.dummy.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ module Client = struct
type verify = { hostname : bool; ip : bool }

let default_verify = { hostname = true; ip = true }
let default_ctx = `Ssl_not_available

type context = Ssl_not_available

let default_ctx = Ssl_not_available
let create_ctx ?certfile:_ ?keyfile:_ ?password:_ () = default_ctx

let connect ?(ctx = default_ctx) ?src:_ ?hostname:_ ?ip:_ ?verify:_ _sa =
Expand Down
9 changes: 6 additions & 3 deletions src/conduit-lwt-unix/conduit_lwt_unix_ssl.dummy.mli
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ module Client : sig
type verify = { hostname : bool; ip : bool }

val default_verify : verify
val default_ctx : [ `Ssl_not_available ]

type context = Ssl_not_available

val default_ctx : context

val create_ctx :
?certfile:string ->
?keyfile:string ->
?password:(bool -> string) ->
unit ->
[ `Ssl_not_available ]
context

val connect :
?ctx:[ `Ssl_not_available ] ->
?ctx:context ->
?src:Lwt_unix.sockaddr ->
?hostname:string ->
?ip:Ipaddr.t ->
Expand Down
2 changes: 2 additions & 0 deletions src/conduit-lwt-unix/conduit_lwt_unix_ssl.real.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ let chans_of_fd sock =
(Lwt_ssl.get_fd sock, ic, oc)

module Client = struct
type context = Ssl.context

let create_ctx ?certfile ?keyfile ?password () =
let ctx = Ssl.create_context Ssl.SSLv23 Ssl.Client_context in
Ssl.disable_protocols ctx [ Ssl.SSLv23 ];
Expand Down
7 changes: 5 additions & 2 deletions src/conduit-lwt-unix/conduit_lwt_unix_ssl.real.mli
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ module Client : sig
type verify = { hostname : bool; ip : bool }

val default_verify : verify
val default_ctx : Ssl.context

type context = Ssl.context

val default_ctx : context

val create_ctx :
?certfile:string ->
Expand All @@ -31,7 +34,7 @@ module Client : sig
Ssl.context

val connect :
?ctx:Ssl.context ->
?ctx:context ->
?src:Lwt_unix.sockaddr ->
?hostname:string ->
?ip:Ipaddr.t ->
Expand Down