[vlc-devel] [PATCH] HLS: fix relative URI resolution

Frédéric Yhuel fyhuel at viotech.net
Tue May 15 15:32:42 CEST 2012


Better than nothing until we have a proper function to make an absolute
URI out of a base and relative path, in VLC core.
---
 modules/stream_filter/httplive.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index eb7dfee..dbe55fc 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -547,7 +547,11 @@ static char *relative_URI(const char *psz_url, const char *psz_path)
     if (strncmp(psz_path, "http", 4) == 0)
         return NULL;
 
-    char    *path_end = strrchr(psz_url, '/');
+    char *path_end = NULL;
+    if (psz_path[0] == '/')
+        path_end = strchr(psz_url + 8, '/');
+    else
+        path_end = strrchr(psz_url, '/');
     if (path_end == NULL)
         return NULL;
     unsigned int    url_length = path_end - psz_url + 1;
-- 
1.7.9.5




More information about the vlc-devel mailing list