Browse Source

fix: allow slash character into appname

pull/235/head
Douglas Goulart 1 year ago
parent
commit
055abfe2e5
  1. 8
      protocol/hls/hls.go
  2. 2
      protocol/rtmp/rtmp.go

8
protocol/hls/hls.go

@ -159,12 +159,8 @@ func (server *Server) parseM3u8(pathstr string) (key string, err error) { @@ -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
}

2
protocol/rtmp/rtmp.go

@ -134,7 +134,7 @@ func (s *Server) handleConn(conn *core.Conn) error { @@ -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

Loading…
Cancel
Save