From ebf6de33d2744fd68f6273e6f66dce94b8c3f552 Mon Sep 17 00:00:00 2001 From: Alex Ashley Date: Tue, 10 Nov 2015 16:25:53 +0000 Subject: hlsdemux: tests: check URL joining if media URL contains a '/' character If the query parameter (for example http://example.net/1054559_1500k.mp4/master.m3u8?acl=/*1054559_1500k.mp4), check that m3u8.c correctly converts the relative URLs of the media playlists in to absolute URLs. It must not use the last '/' it finds in the URL, as according to RFC3986 the '/' character is allowed in the query part of the URL. https://bugzilla.gnome.org/show_bug.cgi?id=758384 --- tests/check/elements/hlsdemux_m3u8.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/check/elements/hlsdemux_m3u8.c b/tests/check/elements/hlsdemux_m3u8.c index d655044ef..f49e90184 100644 --- a/tests/check/elements/hlsdemux_m3u8.c +++ b/tests/check/elements/hlsdemux_m3u8.c @@ -1333,6 +1333,26 @@ GST_START_TEST (test_simulation) GST_END_TEST; #endif +GST_START_TEST (test_url_with_slash_query_param) +{ + static const gchar *MASTER_PLAYLIST = "#EXTM3U \n" + "#EXT-X-VERSION:4\n" + "#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1251135, CODECS=\"avc1.42001f, mp4a.40.2\", RESOLUTION=640x352\n" + "1251/media.m3u8?acl=/*1054559_h264_1500k.mp4\n"; + GstM3U8Client *client; + GstM3U8 *media; + + client = load_playlist (MASTER_PLAYLIST); + + assert_equals_int (g_list_length (client->main->lists), 1); + media = g_list_nth_data (client->main->lists, 0); + assert_equals_string (media->uri, + "http://localhost/1251/media.m3u8?acl=/*1054559_h264_1500k.mp4"); + gst_m3u8_client_free (client); +} + +GST_END_TEST; + GST_START_TEST (test_stream_inf_tag) { static const gchar *MASTER_PLAYLIST = "#EXTM3U \n" @@ -1396,6 +1416,7 @@ hlsdemux_suite (void) #endif tcase_add_test (tc_m3u8, test_playlist_with_doubles_duration); tcase_add_test (tc_m3u8, test_playlist_with_encryption); + tcase_add_test (tc_m3u8, test_url_with_slash_query_param); tcase_add_test (tc_m3u8, test_stream_inf_tag); return s; } -- cgit v1.2.1