mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-05 16:26:50 +08:00
Code refactoring for RTSP auth
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user