Skip to content

Commit

Permalink
reply with 401 when publish key is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Jan 3, 2020
1 parent 7791827 commit e3ebd21
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e3ebd21

Please sign in to comment.