support proxying streams with control paths that start with '?'

This commit is contained in:
aler9 2020-11-03 12:08:24 +01:00
parent 2f5b0160ad
commit 0777204b38
4 changed files with 9 additions and 9 deletions

2
go.mod
View File

@ -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

4
go.sum
View File

@ -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=

View File

@ -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
}

View File

@ -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")