mirror of
https://github.com/bluenviron/mediamtx
synced 2025-03-25 04:18:48 +00:00
reply with 401 when publish key is missing
This commit is contained in:
parent
77918272df
commit
e3ebd21659
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user