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:
Marcelo Roberto Jimenez
2006-12-23 18:38:00 +00:00
parent 819ad1f365
commit 1d9e8712b7
7 changed files with 265 additions and 216 deletions

View File

@@ -228,20 +228,19 @@ send_error_response( IN SOCKINFO * info,
// make headers
membuffer_init( &headers );
/* -- PATCH START - Sergey 'Jin' Bostandzhyan <jin_eld at users.sourceforge.net> */
if( http_MakeMessage( &headers, major, minor,
"RNsDsSXcc" "sssss",
500,
content_length,
ContentTypeHeader,
"EXT:\r\n",
X_USER_AGENT,
start_body, err_code_str, mid_body, err_msg,
end_body ) != 0 ) {
if (http_MakeMessage(
&headers, major, minor,
"RNsDsSXcc" "sssss",
500,
content_length,
ContentTypeHeader,
"EXT:\r\n",
X_USER_AGENT,
start_body, err_code_str, mid_body, err_msg,
end_body ) != 0 ) {
membuffer_destroy( &headers );
return; // out of mem
}
/*-- PATCH END - */
// send err msg
http_SendMessage( info, &timeout_secs, "b",
headers.buf, headers.length );
@@ -270,10 +269,9 @@ send_var_query_response( IN SOCKINFO * info,
{
off_t content_length;
int timeout_secs = SOAP_TIMEOUT;
int major,
minor;
int major;
int minor;
const char *start_body =
// "<?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"
@@ -297,19 +295,18 @@ send_var_query_response( IN SOCKINFO * info,
// make headers
membuffer_init( &response );
/* -- PATCH START - Sergey 'Jin' Bostandzhyan <jin_eld at users.sourceforge.net> */
if( http_MakeMessage( &response, major, minor,
"RNsDsSXcc" "sss",
HTTP_OK,
content_length,
ContentTypeHeader,
"EXT:\r\n",
X_USER_AGENT,
start_body, var_value, end_body ) != 0 ) {
if (http_MakeMessage(
&response, major, minor,
"RNsDsSXcc" "sss",
HTTP_OK,
content_length,
ContentTypeHeader,
"EXT:\r\n",
X_USER_AGENT,
start_body, var_value, end_body ) != 0 ) {
membuffer_destroy( &response );
return; // out of mem
}
/* -- PATCH END - */
// send msg
http_SendMessage( info, &timeout_secs, "b",
@@ -717,17 +714,22 @@ send_action_response( IN SOCKINFO * info,
goto error_handler;
}
content_length = strlen( start_body ) + strlen( xml_response ) +
content_length =
strlen( start_body ) +
strlen( xml_response ) +
strlen( end_body );
// make headers
/* -- PATCH START - Sergey 'Jin' Bostandzhyan <jin_eld at users.sourceforge.net> */
if( http_MakeMessage( &headers, major, minor, "RNsDsSXcc", HTTP_OK, // status code
content_length, ContentTypeHeader, "EXT:\r\n", X_USER_AGENT // EXT header
) != 0 ) {
if (http_MakeMessage(
&headers, major, minor,
"RNsDsSXcc",
HTTP_OK, // status code
content_length,
ContentTypeHeader,
"EXT:\r\n",
X_USER_AGENT) != 0 ) {
goto error_handler;
}
/* -- PATCH END - */
// send whole msg
ret_code = http_SendMessage( info, &timeout_secs, "bbbb",