forked from External/mediamtx
reply with 401 when publish key is missing
This commit is contained in:
parent
77918272df
commit
e3ebd21659
1 changed files with 2 additions and 6 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue