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
This commit is contained in:
Alex Ashley 2014-02-21 09:30:49 +00:00 committed by Sebastian Dröge
parent 966fb81db0
commit 91775a1abd

View file

@ -771,7 +771,15 @@ uri_join (const gchar * uri1, const gchar * uri2)
uri_copy = g_strdup (uri1); uri_copy = g_strdup (uri1);
if (uri2[0] != '/') { if (uri2[0] != '/') {
/* uri2 is a relative uri2 */ /* uri2 is a relative uri2 */
/* 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, '/'); tmp = g_utf8_strrchr (uri_copy, -1, '/');
}
if (!tmp) { if (!tmp) {
GST_WARNING ("Can't build a valid uri_copy"); GST_WARNING ("Can't build a valid uri_copy");
goto out; goto out;