Code refactoring for RTSP auth

This commit is contained in:
Alex X
2025-02-18 12:01:55 +03:00
parent 9e673559c4
commit 02ac3a6814
3 changed files with 9 additions and 9 deletions

View File

@@ -85,14 +85,14 @@ func (a *Auth) Write(req *Request) {
}
}
func (a *Auth) Validate(req *Request) bool {
func (a *Auth) Validate(req *Request) (valid, empty bool) {
if a == nil {
return true
return true, true
}
header := req.Header.Get("Authorization")
if header == "" {
return false
return false, true
}
if a.Method == AuthUnknown {
@@ -100,7 +100,7 @@ func (a *Auth) Validate(req *Request) bool {
a.header = "Basic " + B64(a.user, a.pass)
}
return header == a.header
return header == a.header, false
}
func (a *Auth) ReadNone(res *Response) bool {