aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-06-11 00:41:16 +0200
committerClombrong <cromblong@egregore.fun>2025-06-11 00:41:16 +0200
commit01c55abaf6bbc1ff59ffa741798f4598632db360 (patch)
tree08b2a812bc3f44fd33fc351d2c5f6d863b9931ab
parent9e2732d729ac12d73fce83b637a25b61a03380d6 (diff)
feat(auth): add MalformedRequest SASL error
-rw-r--r--lib/auth.ml2
-rw-r--r--test/js/websockets_hello.ml3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/auth.ml b/lib/auth.ml
index 450c89b..c1486d6 100644
--- a/lib/auth.ml
+++ b/lib/auth.ml
@@ -4,9 +4,11 @@ type auth_mechanism = PLAIN [@@deriving show { with_path = false }]
type sasl_error =
| NotAuthorized
+ | MalformedRequest
let read_sasl_error = function
| "not-authorized" -> NotAuthorized
+ | "malformed-request" -> MalformedRequest
| _ -> failwith "Unsupported SASL error returned by the server."
type sasl_auth = (string option, sasl_error * (string * string) option) result
diff --git a/test/js/websockets_hello.ml b/test/js/websockets_hello.ml
index 9043501..fb88e04 100644
--- a/test/js/websockets_hello.ml
+++ b/test/js/websockets_hello.ml
@@ -23,7 +23,8 @@ let main (stream, push) =
Auth.PLAIN
in push None;
match _auth with
- | Error (NotAuthorized, Some ("en", text)) -> print_endline text
+ | Error (NotAuthorized, Some (_, text)) -> print_endline ("Not authorized: " ^ text)
+ | Error (MalformedRequest, Some (_, text)) -> print_endline ("Malformed request: " ^ text)
| _ -> ()
let () =