Add check for RTSPtoWeb API

This commit is contained in:
Alexey Khit
2022-11-04 22:12:00 +03:00
parent ff96257252
commit e287b52808

View File

@@ -55,6 +55,10 @@ func initAPI() {
// /stream/{id}/channel/0/webrtc // /stream/{id}/channel/0/webrtc
default: default:
i := strings.IndexByte(r.RequestURI[8:], '/') i := strings.IndexByte(r.RequestURI[8:], '/')
if i <= 0 {
log.Warn().Msgf("wrong request: %s", r.RequestURI)
return
}
name := r.RequestURI[8 : 8+i] name := r.RequestURI[8 : 8+i]
stream := streams.Get(name) stream := streams.Get(name)