summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ashley <bugzilla@ashley-family.net>2014-02-21 09:30:49 +0000
committerSebastian Dröge <sebastian@centricular.com>2014-02-28 09:37:36 +0100
commit10744b91436104be4f31874064d587dee19aab94 (patch)
treea15b616c0c5ab73a3ac939857a21c1c1b216eb80
parentde68e60526b7363af256283c2195c34dd4a4604d (diff)
downloadgstreamer-plugins-bad-10744b91436104be4f31874064d587dee19aab94.tar.gz
hlsdemux: Fix for URLs that contain a '/' in the query parameter
If the URL for the master manifest files contains a '/' character in the query parameter (for example http://example.net/1054559_h264_1500k.mp4/master.m3u8?acl=/*1054559_h264_1500k.mp4), hlsdemux is incorrectly converting the relative URLs of the media playlists in to absolute URLs. It is incorrectly using the last '/' it finds in the URL. According to RFC3986 the '/' character is allowed in the query part of the URL. https://bugzilla.gnome.org/show_bug.cgi?id=725137
-rw-r--r--ext/hls/m3u8.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
index a5903b89a..91d00bcb6 100644
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -795,7 +795,15 @@ uri_join (const gchar * uri1, const gchar * uri2)
uri_copy = g_strdup (uri1);
if (uri2[0] != '/') {
/* uri2 is a relative uri2 */
- tmp = g_utf8_strrchr (uri_copy, -1, '/');
+ /* look for query params */
+ tmp = g_utf8_strchr (uri_copy, -1, '?');
+ if (tmp) {
+ /* find last / char, ignoring query params */
+ tmp = g_utf8_strrchr (uri_copy, tmp - uri_copy, '/');
+ } else {
+ /* find last / char in URL */
+ tmp = g_utf8_strrchr (uri_copy, -1, '/');
+ }
if (!tmp) {
GST_WARNING ("Can't build a valid uri_copy");
goto out;