Commit 0ec04296 authored by Fabrizio Gennari's avatar Fabrizio Gennari Committed by Jean-Baptiste Kempf

Support for LG N1A1 UPnP server

Connecting to a LG N1A1 NAS device gave:
upnp services discovery error: browse() response parsing failed

There is a "ugly hack" ("The DIDL document is extracted from the Result tag,
then wrapped into a valid XML header and a new root tag") in the code now.
This actually break parsing the reply by the LG N1A1.

Now, we try parsing the reply as is, and uses the "ugly hack" as a fallback only.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 78fd35bd
...@@ -259,6 +259,14 @@ IXML_Document* parseBrowseResult( IXML_Document* p_doc ) ...@@ -259,6 +259,14 @@ IXML_Document* parseBrowseResult( IXML_Document* p_doc )
{ {
assert( p_doc ); assert( p_doc );
const char* psz_raw_didl = xml_getChildElementValue( p_doc, "Result" );
if( !psz_raw_didl )
return NULL;
/* First, try parsing the buffer as is */
IXML_Document* p_result_doc = ixmlParseBuffer( psz_raw_didl );
if( !p_result_doc ) {
/* Missing namespaces confuse the ixml parser. This is a very ugly /* Missing namespaces confuse the ixml parser. This is a very ugly
* hack but it is needeed until devices start sending valid XML. * hack but it is needeed until devices start sending valid XML.
* *
...@@ -273,19 +281,14 @@ IXML_Document* parseBrowseResult( IXML_Document* p_doc ) ...@@ -273,19 +281,14 @@ IXML_Document* parseBrowseResult( IXML_Document* p_doc )
"<Result xmlns:sec=\"urn:samsung:metadata:2009\">%s</Result>"; "<Result xmlns:sec=\"urn:samsung:metadata:2009\">%s</Result>";
char* psz_xml_result_string = NULL; char* psz_xml_result_string = NULL;
const char* psz_raw_didl = xml_getChildElementValue( p_doc, "Result" );
if( !psz_raw_didl )
return NULL;
if( -1 == asprintf( &psz_xml_result_string, if( -1 == asprintf( &psz_xml_result_string,
psz_xml_result_fmt, psz_xml_result_fmt,
psz_raw_didl) ) psz_raw_didl) )
return NULL; return NULL;
p_result_doc = ixmlParseBuffer( psz_xml_result_string );
IXML_Document* p_result_doc = ixmlParseBuffer( psz_xml_result_string );
free( psz_xml_result_string ); free( psz_xml_result_string );
}
if( !p_result_doc ) if( !p_result_doc )
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment