From e42b135f2c0f5b8e4faef8f6451336d05bb43605 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sat, 18 Jul 2020 13:53:24 +0200 Subject: [PATCH] support SETUP with mode=record in uppercase (#40) --- go.mod | 2 +- go.sum | 4 ++-- server-client.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 78e680c0..be8c2979 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.13 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-20200718113358-4754822be147 + github.com/aler9/gortsplib v0.0.0-20200718114958-1d365c8c9369 github.com/pion/sdp v1.3.0 github.com/stretchr/testify v1.5.1 gopkg.in/alecthomas/kingpin.v2 v2.2.6 diff --git a/go.sum b/go.sum index 3ecc4062..521c4961 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-20200718113358-4754822be147 h1:1rPmAAdNf9bdxXWuY9PSko6eFMjwLiwlTXbOukG0cFg= -github.com/aler9/gortsplib v0.0.0-20200718113358-4754822be147/go.mod h1:17dcA4Qak5TLqgun8OR0wnSbFQIg4cvYVSf1nbCt+qU= +github.com/aler9/gortsplib v0.0.0-20200718114958-1d365c8c9369 h1:7t451d8q3yYtUwQM6GqJPCek13BC0yeh0tQqWrxyuck= +github.com/aler9/gortsplib v0.0.0-20200718114958-1d365c8c9369/go.mod h1:17dcA4Qak5TLqgun8OR0wnSbFQIg4cvYVSf1nbCt+qU= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pion/rtcp v1.2.3 h1:2wrhKnqgSz91Q5nzYTO07mQXztYPtxL8a0XOss4rJqA= diff --git a/server-client.go b/server-client.go index 0f329b4f..d3aba69e 100644 --- a/server-client.go +++ b/server-client.go @@ -491,7 +491,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { return false } - rtpPort, rtcpPort := th.GetPorts("client_port") + rtpPort, rtcpPort := th.Ports("client_port") if rtpPort == 0 || rtcpPort == 0 { c.writeResError(req, gortsplib.StatusBadRequest, fmt.Errorf("transport header does not have valid client ports (%v)", req.Header["Transport"])) return false @@ -578,7 +578,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { // record case clientStateAnnounce, clientStatePreRecord: - if _, ok := th["mode=record"]; !ok { + if strings.ToLower(th.Value("mode")) != "record" { c.writeResError(req, gortsplib.StatusBadRequest, fmt.Errorf("transport header does not contain mode=record")) return false } @@ -606,7 +606,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { return false } - rtpPort, rtcpPort := th.GetPorts("client_port") + rtpPort, rtcpPort := th.Ports("client_port") if rtpPort == 0 || rtcpPort == 0 { c.writeResError(req, gortsplib.StatusBadRequest, fmt.Errorf("transport header does not have valid client ports (%s)", req.Header["Transport"])) return false @@ -657,7 +657,7 @@ func (c *serverClient) handleRequest(req *gortsplib.Request) bool { return false } - interleaved := th.GetValue("interleaved") + interleaved := th.Value("interleaved") if interleaved == "" { c.writeResError(req, gortsplib.StatusBadRequest, fmt.Errorf("transport header does not contain the interleaved field")) return false