SF Tracker [ 1628552 ] XML white space patch
Submitted By: Fredrik Svensson - svefredrik A few modifications to the patch were made: 1) Do not introduce new CRLF's where there were none. 2) Applied the same original idea to two other palces in soap_ctrlpt.c. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@114 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
9595ddcf3a
commit
ae7ca6a2cf
@ -146,7 +146,7 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
|||||||
if( ( child != NULL )
|
if( ( child != NULL )
|
||||||
&& ( ixmlNode_getNodeType( child ) ==
|
&& ( ixmlNode_getNodeType( child ) ==
|
||||||
eELEMENT_NODE ) ) {
|
eELEMENT_NODE ) ) {
|
||||||
ixml_membuf_append_str( buf, ">\n" );
|
ixml_membuf_append_str( buf, ">\r\n" );
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
|||||||
&& ixmlNode_getNodeType( sibling ) == eTEXT_NODE ) {
|
&& ixmlNode_getNodeType( sibling ) == eTEXT_NODE ) {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str( buf, ">\n" );
|
ixml_membuf_append_str( buf, ">\r\n" );
|
||||||
}
|
}
|
||||||
ixmlPrintDomTreeRecursive( ixmlNode_getNextSibling
|
ixmlPrintDomTreeRecursive( ixmlNode_getNextSibling
|
||||||
( nodeptr ), buf );
|
( nodeptr ), buf );
|
||||||
@ -227,7 +227,7 @@ ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
|||||||
child = ixmlNode_getFirstChild( nodeptr );
|
child = ixmlNode_getFirstChild( nodeptr );
|
||||||
if( ( child != NULL )
|
if( ( child != NULL )
|
||||||
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
|
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
|
||||||
ixml_membuf_append_str( buf, ">\n" );
|
ixml_membuf_append_str( buf, ">\r\n" );
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
|||||||
// Done with children. Output the end tag.
|
// Done with children. Output the end tag.
|
||||||
ixml_membuf_append_str( buf, "</" );
|
ixml_membuf_append_str( buf, "</" );
|
||||||
ixml_membuf_append_str( buf, nodeName );
|
ixml_membuf_append_str( buf, nodeName );
|
||||||
ixml_membuf_append_str( buf, ">\n" );
|
ixml_membuf_append_str( buf, ">\r\n" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -372,7 +372,7 @@ ixmlPrintDocument(IXML_Document *doc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ixml_membuf_init( buf );
|
ixml_membuf_init( buf );
|
||||||
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\n" );
|
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" );
|
||||||
ixmlPrintDomTree( rootNode, buf );
|
ixmlPrintDomTree( rootNode, buf );
|
||||||
return buf->buf;
|
return buf->buf;
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ ixmlDocumenttoString(IXML_Document *doc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ixml_membuf_init( buf );
|
ixml_membuf_init( buf );
|
||||||
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\n" );
|
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" );
|
||||||
ixmlDomTreetoString( rootNode, buf );
|
ixmlDomTreetoString( rootNode, buf );
|
||||||
return buf->buf;
|
return buf->buf;
|
||||||
|
|
||||||
|
@ -196,11 +196,12 @@ addToAction( IN int response,
|
|||||||
|
|
||||||
if( response ) {
|
if( response ) {
|
||||||
sprintf( ActBuff,
|
sprintf( ActBuff,
|
||||||
"<u:%sResponse xmlns:u=\"%s\"></u:%sResponse>",
|
"<u:%sResponse xmlns:u=\"%s\"></u:%sResponse>",
|
||||||
ActionName, ServType, ActionName );
|
ActionName, ServType, ActionName );
|
||||||
} else {
|
} else {
|
||||||
sprintf( ActBuff, "<u:%s xmlns:u=\"%s\"></u:%s>",
|
sprintf( ActBuff,
|
||||||
ActionName, ServType, ActionName );
|
"<u:%s xmlns:u=\"%s\"></u:%s>",
|
||||||
|
ActionName, ServType, ActionName );
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ixmlParseBufferEx( ActBuff, ActionDoc );
|
rc = ixmlParseBufferEx( ActBuff, ActionDoc );
|
||||||
@ -274,11 +275,13 @@ makeAction( IN int response,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( response ) {
|
if( response ) {
|
||||||
sprintf( ActBuff, "<u:%sResponse xmlns:u=\"%s\"></u:%sResponse>",
|
sprintf( ActBuff,
|
||||||
ActionName, ServType, ActionName );
|
"<u:%sResponse xmlns:u=\"%s\"></u:%sResponse>",
|
||||||
|
ActionName, ServType, ActionName );
|
||||||
} else {
|
} else {
|
||||||
sprintf( ActBuff, "<u:%s xmlns:u=\"%s\"></u:%s>",
|
sprintf( ActBuff,
|
||||||
ActionName, ServType, ActionName );
|
"<u:%s xmlns:u=\"%s\"></u:%s>",
|
||||||
|
ActionName, ServType, ActionName );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ixmlParseBufferEx( ActBuff, &ActionDoc ) != IXML_SUCCESS ) {
|
if( ixmlParseBufferEx( ActBuff, &ActionDoc ) != IXML_SUCCESS ) {
|
||||||
|
@ -604,10 +604,13 @@ SoapSendAction( IN char *action_url,
|
|||||||
|
|
||||||
off_t content_length;
|
off_t content_length;
|
||||||
char *xml_start =
|
char *xml_start =
|
||||||
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
"<s:Envelope "
|
||||||
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n"
|
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||||
|
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n"
|
||||||
"<s:Body>";
|
"<s:Body>";
|
||||||
char *xml_end = "</s:Body>\n" "</s:Envelope>\n";
|
char *xml_end =
|
||||||
|
"</s:Body>\r\n"
|
||||||
|
"</s:Envelope>\r\n\r\n";
|
||||||
int xml_start_len;
|
int xml_start_len;
|
||||||
int xml_end_len;
|
int xml_end_len;
|
||||||
int action_str_len;
|
int action_str_len;
|
||||||
@ -742,19 +745,25 @@ SoapSendActionEx( IN char *action_url,
|
|||||||
xboolean got_response = FALSE;
|
xboolean got_response = FALSE;
|
||||||
|
|
||||||
char *xml_start =
|
char *xml_start =
|
||||||
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
"<s:Envelope "
|
||||||
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n";
|
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||||
char *xml_body_start = "<s:Body>";
|
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n";
|
||||||
char *xml_end = "</s:Body>\n" "</s:Envelope>\n";
|
char *xml_header_start =
|
||||||
|
"<s:Header>\r\n";
|
||||||
|
char *xml_header_end =
|
||||||
|
"</s:Header>\r\n";
|
||||||
|
char *xml_body_start =
|
||||||
|
"<s:Body>";
|
||||||
|
char *xml_end =
|
||||||
|
"</s:Body>\r\n"
|
||||||
|
"</s:Envelope>\r\n";
|
||||||
int xml_start_len;
|
int xml_start_len;
|
||||||
int xml_end_len;
|
|
||||||
char *xml_header_start = "<s:Header>\n";
|
|
||||||
char *xml_header_end = "</s:Header>\n";
|
|
||||||
int xml_header_start_len;
|
int xml_header_start_len;
|
||||||
int xml_header_end_len;
|
|
||||||
int xml_header_str_len;
|
int xml_header_str_len;
|
||||||
int action_str_len;
|
int xml_header_end_len;
|
||||||
int xml_body_start_len;
|
int xml_body_start_len;
|
||||||
|
int action_str_len;
|
||||||
|
int xml_end_len;
|
||||||
off_t content_length;
|
off_t content_length;
|
||||||
|
|
||||||
*response_node = NULL; // init
|
*response_node = NULL; // init
|
||||||
@ -795,7 +804,7 @@ SoapSendActionEx( IN char *action_url,
|
|||||||
url.hostport.text.size,
|
url.hostport.text.size,
|
||||||
url.hostport.text.buff ); )
|
url.hostport.text.buff ); )
|
||||||
|
|
||||||
xml_start_len = strlen( xml_start );
|
xml_start_len = strlen( xml_start );
|
||||||
xml_body_start_len = strlen( xml_body_start );
|
xml_body_start_len = strlen( xml_body_start );
|
||||||
xml_end_len = strlen( xml_end );
|
xml_end_len = strlen( xml_end );
|
||||||
action_str_len = strlen( action_str );
|
action_str_len = strlen( action_str );
|
||||||
@ -896,15 +905,18 @@ SoapGetServiceVarStatus( IN char *action_url,
|
|||||||
|
|
||||||
off_t content_length;
|
off_t content_length;
|
||||||
char *xml_start =
|
char *xml_start =
|
||||||
// "<?xml version=\"1.0\"?>\n" required??
|
"<s:Envelope "
|
||||||
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||||
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n"
|
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n"
|
||||||
"<s:Body>\n"
|
"<s:Body>\r\n"
|
||||||
"<u:QueryStateVariable xmlns:u=\"urn:schemas-upnp-org:control-1-0\">\n"
|
"<u:QueryStateVariable xmlns:u=\"urn:schemas-upnp-org:control-1-0\">\r\n"
|
||||||
"<u:varName>";
|
"<u:varName>";
|
||||||
|
|
||||||
char *xml_end = "</u:varName>\n"
|
char *xml_end =
|
||||||
"</u:QueryStateVariable>\n" "</s:Body>\n" "</s:Envelope>\n";
|
"</u:varName>\r\n"
|
||||||
|
"</u:QueryStateVariable>\r\n"
|
||||||
|
"</s:Body>\r\n"
|
||||||
|
"</s:Envelope>\r\n";
|
||||||
|
|
||||||
*var_value = NULL; // return NULL in case of an error
|
*var_value = NULL; // return NULL in case of an error
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user