From 0777204b389ea5d89914891143b48c9c081c4cea Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Tue, 3 Nov 2020 12:08:24 +0100 Subject: [PATCH] support proxying streams with control paths that start with '?' --- go.mod | 2 +- go.sum | 4 ++-- internal/client/client.go | 6 +++--- internal/conf/pathconf.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 699c7423..9e0692d0 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-20201102190352-1679c10b8613 + github.com/aler9/gortsplib v0.0.0-20201103110533-300a0e1b1ee1 github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.4.9 github.com/notedit/rtmp v0.0.2 diff --git a/go.sum b/go.sum index 87d98b21..cd65e37c 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/aler9/gortsplib v0.0.0-20201102190352-1679c10b8613 h1:pcTP16VmRhxnSF81yH8w+jrsEDx7Bn5wvBW1UhmbXTs= -github.com/aler9/gortsplib v0.0.0-20201102190352-1679c10b8613/go.mod h1:deK6SPVKRAU3ubv8GcqXPfU1XvQbcbBeRzWTanur/kY= +github.com/aler9/gortsplib v0.0.0-20201103110533-300a0e1b1ee1 h1:LitKgGBf7/JpQI/c5cxwB7tWFJmlMqtAFUNTjd3sAvU= +github.com/aler9/gortsplib v0.0.0-20201103110533-300a0e1b1ee1/go.mod h1:deK6SPVKRAU3ubv8GcqXPfU1XvQbcbBeRzWTanur/kY= github.com/aler9/sdp-dirty/v3 v3.0.0-20201102190219-9156f173e854 h1:yx5M+vqnT9m6JGK/POMDd3vaHOlcwq0DQMRbgnTGALo= github.com/aler9/sdp-dirty/v3 v3.0.0-20201102190219-9156f173e854/go.mod h1:5bO/aUQr9m3OasDatNNcVqKAgs7r5hgGXmszWHaC6mI= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= diff --git a/internal/client/client.go b/internal/client/client.go index c9a4e8f2..2795ab69 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -478,9 +478,9 @@ func (c *Client) handleRequest(req *base.Request) error { return errRunTerminate } - basePath, controlPath, ok := req.URL.BaseControlPath() + basePath, controlPath, ok := req.URL.BasePathControlAttr() if !ok { - c.writeResError(cseq, base.StatusBadRequest, fmt.Errorf("unable to find control path (%s)", req.URL)) + c.writeResError(cseq, base.StatusBadRequest, fmt.Errorf("unable to find control attribute (%s)", req.URL)) return errRunTerminate } @@ -498,7 +498,7 @@ func (c *Client) handleRequest(req *base.Request) error { } if !strings.HasPrefix(controlPath, "trackID=") { - c.writeResError(cseq, base.StatusBadRequest, fmt.Errorf("invalid control path (%s)", controlPath)) + c.writeResError(cseq, base.StatusBadRequest, fmt.Errorf("invalid control attribute (%s)", controlPath)) return errRunTerminate } diff --git a/internal/conf/pathconf.go b/internal/conf/pathconf.go index df522188..31afd0ea 100644 --- a/internal/conf/pathconf.go +++ b/internal/conf/pathconf.go @@ -83,9 +83,9 @@ func (pconf *PathConf) fillAndCheck(name string) error { return fmt.Errorf("'%s' is not a valid rtsp url", pconf.Source) } - if u.User() != nil { - pass, _ := u.User().Password() - user := u.User().Username() + if u.User != nil { + pass, _ := u.User.Password() + user := u.User.Username() if user != "" && pass == "" || user == "" && pass != "" { fmt.Errorf("username and password must be both provided")