diff --git a/internal/core/hls_server_test.go b/internal/core/hls_server_test.go index 7bced354..64ff4b60 100644 --- a/internal/core/hls_server_test.go +++ b/internal/core/hls_server_test.go @@ -48,6 +48,7 @@ func (ts *testHTTPAuthenticator) onAuth(ctx *gin.Context) { Password string `json:"password"` Path string `json:"path"` Action string `json:"action"` + Query string `json:"query"` } err := json.NewDecoder(ctx.Request.Body).Decode(&in) if err != nil { @@ -66,7 +67,10 @@ func (ts *testHTTPAuthenticator) onAuth(ctx *gin.Context) { in.User != user || in.Password != "testpass" || in.Path != "teststream" || - in.Action != ts.action { + in.Action != ts.action || + (in.Query != "user=testreader&pass=testpass¶m=value" && + in.Query != "user=testpublisher&pass=testpass¶m=value" && + in.Query != "param=value") { ctx.AbortWithStatus(http.StatusBadRequest) return } @@ -156,7 +160,7 @@ func TestHLSServerAuth(t *testing.T) { "-i", "emptyvideo.mkv", "-c", "copy", "-f", "rtsp", - "rtsp://testpublisher:testpass@127.0.0.1:8554/teststream", + "rtsp://testpublisher:testpass@127.0.0.1:8554/teststream?param=value", }) require.NoError(t, err) defer cnt1.close() @@ -178,7 +182,7 @@ func TestHLSServerAuth(t *testing.T) { usr = "testreader2" } - res, err := http.Get("http://" + usr + ":testpass@127.0.0.1:8888/teststream/index.m3u8") + res, err := http.Get("http://" + usr + ":testpass@127.0.0.1:8888/teststream/index.m3u8?param=value") require.NoError(t, err) defer res.Body.Close() diff --git a/internal/core/rtmp_server_test.go b/internal/core/rtmp_server_test.go index bfbbe92a..7a536d7a 100644 --- a/internal/core/rtmp_server_test.go +++ b/internal/core/rtmp_server_test.go @@ -120,7 +120,7 @@ func TestRTMPServerAuth(t *testing.T) { "-i", "emptyvideo.mkv", "-c", "copy", "-f", "flv", - "rtmp://127.0.0.1/teststream?user=testpublisher&pass=testpass", + "rtmp://127.0.0.1/teststream?user=testpublisher&pass=testpass¶m=value", }) require.NoError(t, err) defer cnt1.close() @@ -135,7 +135,7 @@ func TestRTMPServerAuth(t *testing.T) { } conn, err := rtmp.DialContext(context.Background(), - "rtmp://127.0.0.1/teststream?user=testreader&pass=testpass") + "rtmp://127.0.0.1/teststream?user=testreader&pass=testpass¶m=value") require.NoError(t, err) defer conn.Close() @@ -189,7 +189,7 @@ func TestRTMPServerAuthFail(t *testing.T) { "-i", "emptyvideo.mkv", "-c", "copy", "-f", "flv", - "rtmp://localhost/teststream?user=testuser2&pass=testpass", + "rtmp://localhost/teststream?user=testuser2&pass=testpass¶m=value", }) require.NoError(t, err) defer cnt1.close() diff --git a/internal/core/rtsp_server_test.go b/internal/core/rtsp_server_test.go index de2c1f0f..52ae915f 100644 --- a/internal/core/rtsp_server_test.go +++ b/internal/core/rtsp_server_test.go @@ -236,7 +236,7 @@ func TestRTSPServerAuth(t *testing.T) { source := gortsplib.Client{} err = source.StartPublishing( - "rtsp://testpublisher:testpass@127.0.0.1:8554/teststream", + "rtsp://testpublisher:testpass@127.0.0.1:8554/teststream?param=value", gortsplib.Tracks{track}) require.NoError(t, err) defer source.Close() @@ -251,7 +251,7 @@ func TestRTSPServerAuth(t *testing.T) { reader := gortsplib.Client{} - err = reader.StartReading("rtsp://testreader:testpass@127.0.0.1:8554/teststream") + err = reader.StartReading("rtsp://testreader:testpass@127.0.0.1:8554/teststream?param=value") require.NoError(t, err) defer reader.Close() }) @@ -407,7 +407,7 @@ func TestRTSPServerAuthFail(t *testing.T) { c := gortsplib.Client{} err = c.StartPublishing( - "rtsp://testpublisher2:testpass@localhost:8554/teststream", + "rtsp://testpublisher2:testpass@localhost:8554/teststream?param=value", gortsplib.Tracks{track}, ) require.EqualError(t, err, "bad status code: 401 (Unauthorized)")