mirror of
https://github.com/aler9/gortsplib
synced 2025-10-07 08:01:14 +08:00
clearer error message
This commit is contained in:
7
auth.go
7
auth.go
@@ -83,8 +83,11 @@ func (as *AuthServer) GenerateHeader() []string {
|
|||||||
// ValidateHeader validates the Authorization header sent by a client after receiving the
|
// ValidateHeader validates the Authorization header sent by a client after receiving the
|
||||||
// WWW-Authenticate header provided by GenerateHeader().
|
// WWW-Authenticate header provided by GenerateHeader().
|
||||||
func (as *AuthServer) ValidateHeader(header []string, method Method, ur *url.URL) error {
|
func (as *AuthServer) ValidateHeader(header []string, method Method, ur *url.URL) error {
|
||||||
if len(header) != 1 {
|
if len(header) == 0 {
|
||||||
return fmt.Errorf("authorization header not provided or provided multiple times")
|
return fmt.Errorf("authorization header not provided")
|
||||||
|
}
|
||||||
|
if len(header) > 1 {
|
||||||
|
return fmt.Errorf("authorization header provided multiple times")
|
||||||
}
|
}
|
||||||
|
|
||||||
head := header[0]
|
head := header[0]
|
||||||
|
Reference in New Issue
Block a user