Thorough revision of every call of http_MakeMessage() due to a bug introduced
in rev.79: largefile patch added. http_MakeMessage() has a worst than brain damaged "printf" like interface. In rev.79, the "N" format parameter must be an off_t. Every call of this function with an "N" format parameter and an int passed on the stack would fail terribly. Not every place I touched had a bug, but to review the format and keep my sanity, I had to format it properly. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@96 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
@@ -601,9 +601,9 @@ SoapSendAction( IN char *action_url,
|
||||
char *upnp_error_str;
|
||||
xboolean got_response = FALSE;
|
||||
|
||||
off_t content_length;
|
||||
char *xml_start =
|
||||
// "<?xml version=\"1.0\"?>\n" required??
|
||||
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n"
|
||||
"<s:Body>";
|
||||
char *xml_end = "</s:Body>\n" "</s:Envelope>\n";
|
||||
@@ -644,19 +644,23 @@ SoapSendAction( IN char *action_url,
|
||||
url.hostport.text.size,
|
||||
url.hostport.text.buff ); )
|
||||
|
||||
xml_start_len = strlen( xml_start );
|
||||
xml_start_len = strlen( xml_start );
|
||||
xml_end_len = strlen( xml_end );
|
||||
action_str_len = strlen( action_str );
|
||||
|
||||
// make request msg
|
||||
request.size_inc = 50;
|
||||
if( http_MakeMessage( &request, 1, 1, "q" "N" "s" "sssbs" "U" "c" "bbb", SOAPMETHOD_POST, &url,
|
||||
(off_t)xml_start_len + action_str_len + xml_end_len, // content-length
|
||||
ContentTypeHeader,
|
||||
"SOAPACTION: \"", service_type, "#", name.buf,
|
||||
name.length, "\"\r\n", xml_start, xml_start_len,
|
||||
action_str, action_str_len, xml_end,
|
||||
xml_end_len ) != 0 ) {
|
||||
content_length = xml_start_len + action_str_len + xml_end_len;
|
||||
if (http_MakeMessage(
|
||||
&request, 1, 1,
|
||||
"q" "N" "s" "sssbsc" "Uc" "b" "b" "b",
|
||||
SOAPMETHOD_POST, &url,
|
||||
content_length,
|
||||
ContentTypeHeader,
|
||||
"SOAPACTION: \"", service_type, "#", name.buf, name.length, "\"",
|
||||
xml_start, xml_start_len,
|
||||
action_str, action_str_len,
|
||||
xml_end, xml_end_len ) != 0 ) {
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
@@ -737,7 +741,6 @@ SoapSendActionEx( IN char *action_url,
|
||||
xboolean got_response = FALSE;
|
||||
|
||||
char *xml_start =
|
||||
// "<?xml version=\"1.0\"?>\n" required??
|
||||
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||
"s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n";
|
||||
char *xml_body_start = "<s:Body>";
|
||||
@@ -751,6 +754,7 @@ SoapSendActionEx( IN char *action_url,
|
||||
int xml_header_str_len;
|
||||
int action_str_len;
|
||||
int xml_body_start_len;
|
||||
off_t content_length;
|
||||
|
||||
*response_node = NULL; // init
|
||||
|
||||
@@ -801,17 +805,24 @@ SoapSendActionEx( IN char *action_url,
|
||||
|
||||
// make request msg
|
||||
request.size_inc = 50;
|
||||
if( http_MakeMessage( &request, 1, 1, "q" "N" "s" "sssbs" "U" "c" "bbbbbbb", SOAPMETHOD_POST, &url, xml_start_len + xml_header_start_len + xml_header_str_len + xml_header_end_len + xml_body_start_len + action_str_len + xml_end_len, // content-length
|
||||
ContentTypeHeader,
|
||||
"SOAPACTION: \"", service_type, "#", name.buf,
|
||||
name.length, "\"\r\n",
|
||||
xml_start, xml_start_len,
|
||||
xml_header_start, xml_header_start_len,
|
||||
xml_header_str, xml_header_str_len,
|
||||
xml_header_end, xml_header_end_len,
|
||||
xml_body_start, xml_body_start_len,
|
||||
action_str, action_str_len,
|
||||
xml_end, xml_end_len ) != 0 ) {
|
||||
content_length =
|
||||
xml_start_len +
|
||||
xml_header_start_len + xml_header_str_len + xml_header_end_len +
|
||||
xml_body_start_len + action_str_len + xml_end_len;
|
||||
if (http_MakeMessage(
|
||||
&request, 1, 1,
|
||||
"q" "N" "s" "sssbsc" "Uc" "bbbbbbb",
|
||||
SOAPMETHOD_POST, &url,
|
||||
content_length,
|
||||
ContentTypeHeader,
|
||||
"SOAPACTION: \"", service_type, "#", name.buf, name.length, "\"",
|
||||
xml_start, xml_start_len,
|
||||
xml_header_start, xml_header_start_len,
|
||||
xml_header_str, xml_header_str_len,
|
||||
xml_header_end, xml_header_end_len,
|
||||
xml_body_start, xml_body_start_len,
|
||||
action_str, action_str_len,
|
||||
xml_end, xml_end_len ) != 0 ) {
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
@@ -882,6 +893,7 @@ SoapGetServiceVarStatus( IN char *action_url,
|
||||
http_parser_t response;
|
||||
int upnp_error_code;
|
||||
|
||||
off_t content_length;
|
||||
char *xml_start =
|
||||
// "<?xml version=\"1.0\"?>\n" required??
|
||||
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||
@@ -903,11 +915,16 @@ SoapGetServiceVarStatus( IN char *action_url,
|
||||
}
|
||||
// make headers
|
||||
request.size_inc = 50;
|
||||
if( http_MakeMessage( &request, 1, 1, "Q" "sbc" "N" "s" "s" "U" "c" "sss", SOAPMETHOD_POST, path.buf, path.length, "HOST: ", host.buf, host.length, strlen( xml_start ) + strlen( var_name ) + strlen( xml_end ), // content-length
|
||||
ContentTypeHeader,
|
||||
"SOAPACTION: \"urn:schemas"
|
||||
"-upnp-org:control-1-0#QueryStateVariable\"\r\n",
|
||||
xml_start, var_name, xml_end ) != 0 ) {
|
||||
content_length = strlen( xml_start ) + strlen( var_name ) + strlen( xml_end );
|
||||
if (http_MakeMessage(
|
||||
&request, 1, 1,
|
||||
"Q" "sbc" "N" "s" "s" "Ucc" "sss",
|
||||
SOAPMETHOD_POST, path.buf, path.length,
|
||||
"HOST: ", host.buf, host.length,
|
||||
content_length,
|
||||
ContentTypeHeader,
|
||||
"SOAPACTION: \"urn:schemas-upnp-org:control-1-0#QueryStateVariable\"",
|
||||
xml_start, var_name, xml_end ) != 0 ) {
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
}
|
||||
// send msg and get reply
|
||||
|
Reference in New Issue
Block a user