From 055abfe2e5ca83d17edc20fd2fb3fa0fc7920b4a Mon Sep 17 00:00:00 2001 From: Douglas Goulart Date: Sat, 6 Apr 2024 18:25:18 -0300 Subject: [PATCH] fix: allow slash character into appname --- protocol/hls/hls.go | 8 ++------ protocol/rtmp/rtmp.go | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/protocol/hls/hls.go b/protocol/hls/hls.go index 482544c..9fe7cf7 100755 --- a/protocol/hls/hls.go +++ b/protocol/hls/hls.go @@ -159,12 +159,8 @@ func (server *Server) parseM3u8(pathstr string) (key string, err error) { func (server *Server) parseTs(pathstr string) (key string, err error) { pathstr = strings.TrimLeft(pathstr, "/") - paths := strings.SplitN(pathstr, "/", 3) - if len(paths) != 3 { - err = fmt.Errorf("invalid path=%s", pathstr) - return - } - key = paths[0] + "/" + paths[1] + paths := strings.Split(pathstr, "/") + key = strings.Join(paths[:len(paths)-1], "/") return } diff --git a/protocol/rtmp/rtmp.go b/protocol/rtmp/rtmp.go index 6693f4c..d91c741 100755 --- a/protocol/rtmp/rtmp.go +++ b/protocol/rtmp/rtmp.go @@ -134,7 +134,7 @@ func (s *Server) handleConn(conn *core.Conn) error { } channel, err := configure.RoomKeys.GetChannel(name) if err != nil { - err := fmt.Errorf("invalid key err=%s", err.Error()) + err := fmt.Errorf("invalid key err=%s, name=%s", err.Error(), name) conn.Close() log.Error("CheckKey err: ", err) return err