From 9f0c5195825baae0f257edd9f728742a10fbfdfd Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sun, 30 May 2021 12:57:23 +0200 Subject: [PATCH] update gortsplib --- go.mod | 2 +- go.sum | 4 ++-- internal/rtspconn/conn.go | 8 ++------ main_rtspsource_test.go | 5 ++--- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 7b80673b..60d3f89e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.15 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect - github.com/aler9/gortsplib v0.0.0-20210530100035-9007f20af845 + github.com/aler9/gortsplib v0.0.0-20210530105246-d07e93f2453e github.com/asticode/go-astits v0.0.0-00010101000000-000000000000 github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.4.9 diff --git a/go.sum b/go.sum index ef5b901d..7485b5fc 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2c github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/aler9/go-astits v0.0.0-20210423195926-582b09ed7c04 h1:CXgQLsU4uxWAmsXNOjGLbj0A+0IlRcpZpMgI13fmVwo= github.com/aler9/go-astits v0.0.0-20210423195926-582b09ed7c04/go.mod h1:DkOWmBNQpnr9mv24KfZjq4JawCFX1FCqjLVGvO0DygQ= -github.com/aler9/gortsplib v0.0.0-20210530100035-9007f20af845 h1:n+YGbS96Q9cK5GeyGRiAsOw3yX1kIkBmr6T8aVQEKH8= -github.com/aler9/gortsplib v0.0.0-20210530100035-9007f20af845/go.mod h1:zVCg+TQX445hh1pC5QgAuuBvvXZMWLY1XYz626dGFqY= +github.com/aler9/gortsplib v0.0.0-20210530105246-d07e93f2453e h1:RlEDgRKJHw0Z07FfsUnuZiqk2lwFwxONXlmiSQCjJrU= +github.com/aler9/gortsplib v0.0.0-20210530105246-d07e93f2453e/go.mod h1:zVCg+TQX445hh1pC5QgAuuBvvXZMWLY1XYz626dGFqY= github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927 h1:95mXJ5fUCYpBRdSOnLAQAdJHHKxxxJrVCiaqDi965YQ= github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927/go.mod h1:vzuE21rowz+lT1NGsWbreIvYulgBpCGnQyeTyFblUHc= github.com/asticode/go-astikit v0.20.0 h1:+7N+J4E4lWx2QOkRdOf6DafWJMv6O4RRfgClwQokrH8= diff --git a/internal/rtspconn/conn.go b/internal/rtspconn/conn.go index f9aa77d3..8a74ec67 100644 --- a/internal/rtspconn/conn.go +++ b/internal/rtspconn/conn.go @@ -209,8 +209,7 @@ func (c *Conn) ValidateCredentials( } }() - err := c.authValidator.ValidateHeader(req.Header["Authorization"], - req.Method, req.URL, altURL) + err := c.authValidator.ValidateRequest(req, altURL) if err != nil { c.authFailures++ @@ -225,9 +224,6 @@ func (c *Conn) ValidateCredentials( Message: "unauthorized: " + err.Error(), Response: &base.Response{ StatusCode: base.StatusUnauthorized, - Header: base.Header{ - "WWW-Authenticate": c.authValidator.GenerateHeader(), - }, }, } } @@ -240,7 +236,7 @@ func (c *Conn) ValidateCredentials( Response: &base.Response{ StatusCode: base.StatusUnauthorized, Header: base.Header{ - "WWW-Authenticate": c.authValidator.GenerateHeader(), + "WWW-Authenticate": c.authValidator.Header(), }, }, } diff --git a/main_rtspsource_test.go b/main_rtspsource_test.go index ab59d7fb..ef18e11f 100644 --- a/main_rtspsource_test.go +++ b/main_rtspsource_test.go @@ -24,13 +24,12 @@ func (sh *testServer) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (*ba sh.authValidator = auth.NewValidator(sh.user, sh.pass, nil) } - err := sh.authValidator.ValidateHeader(ctx.Req.Header["Authorization"], - ctx.Req.Method, ctx.Req.URL, nil) + err := sh.authValidator.ValidateRequest(ctx.Req, nil) if err != nil { return &base.Response{ StatusCode: base.StatusUnauthorized, Header: base.Header{ - "WWW-Authenticate": sh.authValidator.GenerateHeader(), + "WWW-Authenticate": sh.authValidator.Header(), }, }, nil, nil }