From e3ebd216590927d26e715f75b0bdc81fa9ca8b27 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Fri, 3 Jan 2020 23:14:27 +0100 Subject: [PATCH] reply with 401 when publish key is missing --- client.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 5e7a81e78af..6adda45d4fa 100644 --- a/client.go +++ b/client.go @@ -313,13 +313,9 @@ func (c *client) handleRequest(req *rtsp.Request) bool { } key, ok := q["key"] - if !ok || len(key) == 0 { - c.writeResError(req, fmt.Errorf("key missing")) - return false - } - - if key[0] != c.p.publishKey { + if !ok || len(key) != 1 || key[0] != c.p.publishKey { // reply with 401 and exit + c.log("ERR: publish key wrong or missing") c.writeRes(&rtsp.Response{ StatusCode: 401, Status: "Unauthorized",