1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge branch '3.0release' into 4.0release

This commit is contained in:
winlin 2020-12-26 22:15:37 +08:00
commit 2538b02a9b
8 changed files with 38 additions and 29 deletions

View file

@ -200,24 +200,26 @@ string srs_generate_tc_url(string host, string vhost, string app, int port)
return tcUrl;
}
string srs_generate_stream_with_query(string host, string vhost, string stream, string param)
string srs_generate_stream_with_query(string host, string vhost, string stream, string param, bool with_vhost)
{
string url = stream;
string query = param;
// If no vhost in param, try to append one.
string guessVhost;
if (query.find("vhost=") == string::npos) {
if (vhost != SRS_CONSTS_RTMP_DEFAULT_VHOST) {
guessVhost = vhost;
} else if (!srs_is_ipv4(host)) {
guessVhost = host;
if (with_vhost) {
// If no vhost in param, try to append one.
string guessVhost;
if (query.find("vhost=") == string::npos) {
if (vhost != SRS_CONSTS_RTMP_DEFAULT_VHOST) {
guessVhost = vhost;
} else if (!srs_is_ipv4(host)) {
guessVhost = host;
}
}
// Well, if vhost exists, always append in query string.
if (!guessVhost.empty()) {
query += "&vhost=" + guessVhost;
}
}
// Well, if vhost exists, always append in query string.
if (!guessVhost.empty()) {
query += "&vhost=" + guessVhost;
}
// Remove the start & when param is empty.