summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-06-28 12:53:47 +0200
committerClombrong <cromblong@egregore.fun>2025-06-28 16:44:54 +0200
commitc633d0b1b27b96002c51228e7ade6327d687f4a1 (patch)
treee4da8446c0c46112a3fe2edb29da6e5970d1c269 /lib
parentb0e746b6c0f9cd9393ff105e6d0e0f0e33ee6a43 (diff)
feat(stream): pass down auth config to the negotiate function
Diffstat (limited to 'lib')
-rw-r--r--lib/stream.ml10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/stream.ml b/lib/stream.ml
index 2b98192..0b600a7 100644
--- a/lib/stream.ml
+++ b/lib/stream.ml
@@ -43,7 +43,11 @@ let parse_features (el : Xml.element) : features =
Basically, it conforms to
{{: https://datatracker.ietf.org/doc/html/rfc6120#section-4.3 }}. *)
-let negotiate ?(prefer_starttls = true) (domain : string) (portal : Portal.t) : features Lwt.t =
+let negotiate
+ ?(prefer_starttls = true)
+ (domain : string)
+ (portal : Portal.t)
+ (_auth : Sasl.auth_config) : features Lwt.t =
(* Restart a stream: Send the usual business, ask for features. *)
let start_stream () : features Lwt.t =
let* _id = Portal.header domain portal
@@ -60,7 +64,7 @@ let negotiate ?(prefer_starttls = true) (domain : string) (portal : Portal.t) :
Once [None] is pushed into the stream, the receiving stream is drained and the
socket is closed. *)
-let initiate (domain : string) : (Portal.t * features) Lwt.t =
+let initiate (domain : string) (auth : Sasl.auth_config) : (Portal.t * features) Lwt.t =
let open Portal in
let* p = connect domain
in let push = function
@@ -70,5 +74,5 @@ let initiate (domain : string) : (Portal.t * features) Lwt.t =
(* Empty the stream completely, then close the socket. *)
Lwt.async (fun () -> let+ () = Markup_lwt.drain p.stream in p.push None)
in let portal = {p with push} in
- let+ features = negotiate domain portal
+ let+ features = negotiate domain portal auth
in (portal, features)