diff options
-rw-r--r-- | portal/portal.mli | 3 | ||||
-rw-r--r-- | portal/tcp/portal.ml | 4 | ||||
-rw-r--r-- | portal/ws/portal.ml | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/portal/portal.mli b/portal/portal.mli index 62a7bd7..ed8765d 100644 --- a/portal/portal.mli +++ b/portal/portal.mli @@ -38,3 +38,6 @@ val starttls : t -> unit Lwt.t When [from] is specified, a from attribute is included. *) val header : ?from:string -> string -> t -> string Lwt.t + +(** [_encrypted socket] returns whether [socket] is encrypted, using TLS or otherwise. *) +val _encrypted : socket -> bool diff --git a/portal/tcp/portal.ml b/portal/tcp/portal.ml index 0105a06..d36563a 100644 --- a/portal/tcp/portal.ml +++ b/portal/tcp/portal.ml @@ -174,6 +174,10 @@ let starttls (portal : t) : unit Lwt.t = | Tls _ -> Lwt.fail_with "TLS is already enabled on this socket!" in portal._socket <- Tls tls_sock +let _encrypted = function + | Plain _ -> false + | Tls _ -> true + let header ?from domain (portal : t) = let stanza = let attributes = diff --git a/portal/ws/portal.ml b/portal/ws/portal.ml index 0d15e5a..5ad82c3 100644 --- a/portal/ws/portal.ml +++ b/portal/ws/portal.ml @@ -164,3 +164,5 @@ let connect domain = {stream; push; _socket=ws} let starttls _ = Lwt.fail_with "STARTTLS is unimplemented in WebSockets." + +let _encrypted _ = true |