- /* Determine host to use */
- if (url && url->psz_host)
- psz_host = strdup(url->psz_host);
- else if (p_sys->m3u8.psz_host)
- psz_host = strdup(p_sys->m3u8.psz_host);
-
- /* Determine path to use */
- if (url && url->psz_path != NULL)
- psz_path = strdup(url->psz_path);
- else if (p_sys->m3u8.psz_path != NULL)
- psz_path = strdup(p_sys->m3u8.psz_path);
-
- if ((psz_protocol == NULL) ||
- (psz_path == NULL) ||
- (psz_host == NULL))
- goto fail;
-
- p = strrchr(psz_path, '/');
- if (p) *p = '\0';
-
- /* Determine credentials to use */
- if (url && url->psz_username)
- psz_username = strdup(url->psz_username);
- else if (p_sys->m3u8.psz_username)
- psz_username = strdup(p_sys->m3u8.psz_username);
-
- if (url && url->psz_password)
- psz_password = strdup(url->psz_password);
- else if (p_sys->m3u8.psz_password)
- psz_password = strdup(p_sys->m3u8.psz_password);
-
- /* */
- if (psz_password || psz_username)
- {
- if (asprintf(&psz_uri, "%s://%s:%s@%s:%d%s/%s",
- psz_protocol,
- psz_username ? psz_username : "",
- psz_password ? psz_password : "",
- psz_host, i_port,
- psz_path, uri) < 0)
- goto fail;
- }
- else
- {
- if (asprintf(&psz_uri, "%s://%s:%d%s/%s",
- psz_protocol, psz_host, i_port,
- psz_path, uri) < 0)
- goto fail;