rtsp: prioritise digest authentication

This pull request solves a problem with security cameras that send both basic and digest realms, prioritising digest authentication.
This commit is contained in:
Gabriele 2024-05-29 17:48:15 +02:00 committed by GitHub
parent b6b1f4a437
commit cbcff0f4fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -418,6 +418,12 @@ func (client *RTSPClient) request(method string, customHeaders map[string]string
if splits[0] == "Content-length" { if splits[0] == "Content-length" {
splits[0] = "Content-Length" splits[0] = "Content-Length"
} }
if val, ok := res[splits[0]]; ok {
if splits[0] == "WWW-Authenticate" && strings.Contains(val, "Digest") && strings.Contains(splits[1], "Basic") {
// prioritise digest authentication
continue
}
}
res[splits[0]] = splits[1] res[splits[0]] = splits[1]
} }
} }