Skip to content

Commit

Permalink
VLive: Support SRT URL filter. v5.12.22
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 11, 2024
1 parent be51744 commit ad16b76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,7 @@ The following are the update records for the SRS Stack server.
* RTSP: Rebuild the URL with escaped user info. v5.12.19
* VLive: Fix rebuild URL bug. v5.12.20
* HLS: Fix LL HLS setting bug. [v5.12.21](https://github.com/ossrs/srs-stack/releases/tag/v5.12.21)
* VLive: Support SRT URL filter. v5.12.22
* v5.11
* VLive: Decrease the latency for virtual live. v5.11.1
* Live: Refine multiple language. v5.11.2
Expand Down
3 changes: 2 additions & 1 deletion platform/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1196,9 +1196,10 @@ func RebuildStreamURL(rawURL string) (*url.URL, error) {
// If parse success, for example, no special chars in username and password, return the URL.
// If host not parsed, we also try to rebuild the stream URL then parse it.
if r0, err := url.Parse(rawURL); err == nil {
isSRT := r0.Scheme == "srt"
hostIsInvalid := r0.Host == ""
pathIsInvalid := r0.Path == "" && r0.RequestURI() != "/"
if !hostIsInvalid && !pathIsInvalid {
if isSRT || (!hostIsInvalid && !pathIsInvalid) {
return r0, err
}
}
Expand Down
2 changes: 2 additions & 0 deletions platform/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ func TestUtils_RebuildStreamURL(t *testing.T) {
{url: "rtsp://Cam@Viewer:abc123@[email protected]:554", rebuild: "rtsp://Cam%40Viewer:abc123%40%3F%[email protected]:554"},
{url: "rtsp://CamViewer:abc123@?!~#$%^&*()_+-=\\|[email protected]:554/Streaming/Channels/101", rebuild: "rtsp://CamViewer:abc123%40%3F%21~%23$%25%5E&%2A%28%29_+-=%5C%7C%[email protected]:554/Streaming/Channels/101"},
{url: "rtsp://CamViewer:abc123@[email protected]:554/Streaming/Channels/101", rebuild: "rtsp://CamViewer:abc123%40347%3F1%[email protected]:554/Streaming/Channels/101"},
{url: "srt://213.171.194.158:10080", rebuild: "srt://213.171.194.158:10080"},
{url: "srt://213.171.194.158:10080?streamid=#!::r=live/primary,latency=20,m=request", rebuild: "srt://213.171.194.158:10080?streamid=#!::r=live/primary,latency=20,m=request"},
}
for _, urlSample := range urlSamples {
if r0, err := RebuildStreamURL(urlSample.url); err != nil {
Expand Down

0 comments on commit ad16b76

Please sign in to comment.