[vlc-devel] [PATCH 6/6] upnp: fix playlist URL manipulation if SAT>IP server provides a channel list itself
Felix Paul Kühne
fkuehne at videolan.org
Wed Jul 20 17:25:22 CEST 2016
---
modules/services_discovery/upnp.cpp | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 59453a4..cdc0dc2 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -482,19 +482,38 @@ void MediaServerList::parseNewServer( IXML_Document *doc, const std::string &loc
}
}
+ char *psz_url;
+ vlc_url_t url;
+ vlc_UrlParse( &url, psz_base_url );
+
/* If requested by the user, check for a SAT>IP m3u list, which may be provided by some rare devices */
if (strncmp(psz_satip_channellist, "ServerList", 10) == 0) {
const char* psz_m3u_url = xml_getChildElementValue( p_device_element, "satip:X_SATIPM3U" );
if ( psz_m3u_url ) {
- if ( strncmp( "http://", psz_m3u_url, 7) && strncmp( "https://", psz_m3u_url, 8) )
+ if ( strncmp( "http", psz_m3u_url, 4) )
{
char* psz_url = NULL;
if ( UpnpResolveURL2( psz_base_url, psz_m3u_url, &psz_url ) == UPNP_E_SUCCESS )
{
+ if (asprintf( &psz_url, "%s?satip-device=%s",
+ psz_url,
+ url.psz_host ) < 0 ) {
+ vlc_UrlClean( &url );
+ free( psz_url );
+ continue;
+ }
+
p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn, psz_friendly_name, psz_url, iconUrl );
free(psz_url);
}
} else {
+ if (asprintf( &psz_url, "%s?satip-device=%s",
+ psz_url,
+ url.psz_host ) < 0 ) {
+ vlc_UrlClean( &url );
+ continue;
+ }
+
p_server = new(std::nothrow) SD::MediaServerDesc( psz_udn, psz_friendly_name, psz_m3u_url, iconUrl );
}
@@ -507,17 +526,14 @@ void MediaServerList::parseNewServer( IXML_Document *doc, const std::string &loc
free(psz_satip_channellist);
} else {
- msg_Warn( m_sd, "SAT>IP server did not provide a playlist");
+ msg_Warn( m_sd, "SAT>IP server '%s' did not provide a playlist", url.psz_host);
}
+ vlc_UrlClean( &url );
continue;
}
/* Normally, fetch a playlist from the web,
* which will be processed by a lua script a bit later */
- char *psz_url;
- vlc_url_t url;
- vlc_UrlParse( &url, psz_base_url );
-
if (asprintf( &psz_url, "http://www.satip.info/Playlists/%s.m3u?satip-device=%s",
psz_satip_channellist,
url.psz_host ) < 0 ) {
--
2.9.2
More information about the vlc-devel
mailing list