Support URI format sent by HappyTime ONVIF and RTSP clients during (#964)

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
Kelvin Lawson
2025-12-22 16:45:14 +00:00
committed by GitHub
parent 94e7927447
commit d0b37aa0dd
2 changed files with 11 additions and 4 deletions

View File

@@ -31,11 +31,11 @@ func urlMatches(expected string, received string, isSetup bool) bool {
return true
}
// in SETUP requests, VLC uses the base URL of the stream
// instead of the URL of the track.
// Strip the control attribute to obtain the URL of the stream.
// in SETUP requests, some clients do not use the track URL:
// - VLC uses the stream base URL (with trailing slash)
// - HappyTime NVR uses the stream URL (without trailing slash)
if isSetup {
if m := reControlAttribute.FindStringSubmatch(expected); m != nil && received == m[1] {
if m := reControlAttribute.FindStringSubmatch(expected); m != nil && (received == m[1] || (received+"/") == m[1]) {
return true
}
}

View File

@@ -48,6 +48,13 @@ var casesVerify = []struct {
"uri=\"rtsp://myhost/mypath?key=val/\", response=\"5ca5ceeca20a05e9a3f49ecde4b42655\"",
},
},
{
"digest happytime",
base.HeaderValue{
`Digest username="myuser", realm="myrealm", nonce="f49ac6dd0ba708d4becddc9692d1f2ce", ` +
`uri="rtsp://myhost/mypath?key=val", response="c11a6e92b449f221dabf494a7a837ee3"`,
},
},
}
func TestVerify(t *testing.T) {