]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
IPTV: m3u parser - fix url parser
authorJaroslav Kysela <perex@perex.cz>
Fri, 30 Oct 2015 20:57:12 +0000 (21:57 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 30 Oct 2015 20:57:12 +0000 (21:57 +0100)
src/input/mpegts/iptv/iptv_http.c

index 8b9f4b3e9a996920488316ef415d540b512da6ba..29cf12b92e4eaa320637df549a6113c894b94078 100644 (file)
@@ -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);