aboutsummaryrefslogtreecommitdiff
path: root/portal/lib/ws/portal.ml
diff options
context:
space:
mode:
Diffstat (limited to 'portal/lib/ws/portal.ml')
-rw-r--r--portal/lib/ws/portal.ml8
1 files changed, 5 insertions, 3 deletions
diff --git a/portal/lib/ws/portal.ml b/portal/lib/ws/portal.ml
index d5362c1..620a238 100644
--- a/portal/lib/ws/portal.ml
+++ b/portal/lib/ws/portal.ml
@@ -7,6 +7,8 @@ let sjs = Js.to_string
type t = (signal, async) stream * ((signal, sync) stream option -> unit)
+let xmlns = "urn:ietf:params:xml:ns:xmpp-framing"
+
(* sic. XEP-0156: "host-meta files MUST be fetched only over HTTPS". I don't make the rules. *)
let well_known_of (domain : string) = "https://" ^ domain ^ "/.well-known/host-meta"
@@ -19,18 +21,18 @@ let stanza_open ?from domain : (signal, sync) stream =
let stanza =
let attributes =
let open Option in
- [(("", "xmlns"), "urn:ietf:params:xml:ns:xmpp-framing");
+ [(("", "xmlns"), xmlns);
(("", "to"), domain)]
@ (map (fun jid -> (("", "from"), jid)) from |> to_list)
@ [(("", "version"), "1.0")]
in
[`Start_element
- (("urn:ietf:params:xml:ns:xmpp-framing", "open"),
+ ((xmlns, "open"),
attributes);
`End_element]
in stanza |> of_list
-let stanza_close = string {|<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />|} |> parse_xml |> signals
+let stanza_close = {|<close xmlns="|} ^ xmlns ^ {|" />|} |> string |> parse_xml |> signals
exception MalformedStanza of Markup.location * Markup.Error.t