Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
IPTV: m3u parser - fix url parser
  • Loading branch information
perexg committed Oct 30, 2015
1 parent 2cab577 commit cb72dbf
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/input/mpegts/iptv/iptv_http.c
Expand Up @@ -148,17 +148,22 @@ iptv_http_complete
}
urlinit(&u);
if (url[0] == '/') {
s = strdupa(im->mm_iptv_url_raw);
if ((p = strchr(s, '/')) != NULL)
*p = '\0';
if (!urlparse(s, &u))
goto invalid;
url2 = malloc(512);
url2[0] = '\0';
if ((p = http_arg_get(&hc->hc_args, "Host")) != NULL) {
snprintf(url2, 512, "%s://%s%s",
hc->hc_ssl ? "https" : "http", p, url);
} else if (im->mm_iptv_url_raw) {
s = strdupa(im->mm_iptv_url_raw);
if ((p = strchr(s, '/')) != NULL) {
p++;
if (*p == '/')
p++;
if ((p = strchr(s, '/')) != NULL)
*p = '\0';
}
if (!urlparse(s, &u))
goto invalid;
snprintf(url2, 512, "%s%s", s, url);
}
free(url);
Expand Down

0 comments on commit cb72dbf

Please sign in to comment.