diff --git a/upnp/src/gena/gena_ctrlpt.c b/upnp/src/gena/gena_ctrlpt.c
index 81ed739..b949db3 100644
--- a/upnp/src/gena/gena_ctrlpt.c
+++ b/upnp/src/gena/gena_ctrlpt.c
@@ -219,10 +219,11 @@ gena_unsubscribe( IN char *url,
// make request msg
membuffer_init( &request );
request.size_inc = 30;
- return_code = http_MakeMessage( &request, 1, 1,
- "q" "ssc" "U" "c",
- HTTPMETHOD_UNSUBSCRIBE, &dest_url,
- "SID: ", sid );
+ return_code = http_MakeMessage(
+ &request, 1, 1,
+ "q" "ssc" "Uc",
+ HTTPMETHOD_UNSUBSCRIBE, &dest_url,
+ "SID: ", sid );
//Not able to make the message so destroy the existing buffer
if( return_code != 0 ) {
@@ -305,20 +306,21 @@ gena_subscribe( IN char *url,
request.size_inc = 30;
if( renewal_sid ) {
// renew subscription
- return_code = http_MakeMessage( &request, 1, 1,
- "q" "ssc" "ssc" "c",
- HTTPMETHOD_SUBSCRIBE, &dest_url,
- "SID: ", renewal_sid,
- "TIMEOUT: Second-", timeout_str );
+ return_code = http_MakeMessage(
+ &request, 1, 1,
+ "q" "ssc" "sscc",
+ HTTPMETHOD_SUBSCRIBE, &dest_url,
+ "SID: ", renewal_sid,
+ "TIMEOUT: Second-", timeout_str );
} else {
// subscribe
- return_code = http_MakeMessage( &request, 1, 1,
- "q" "sssdsscc",
- HTTPMETHOD_SUBSCRIBE, &dest_url,
- "CALLBACK: \r\n" "NT: upnp:event\r\n"
- "TIMEOUT: Second-", timeout_str );
+ return_code = http_MakeMessage(
+ &request, 1, 1,
+ "q" "sssdsc" "sc" "sscc",
+ HTTPMETHOD_SUBSCRIBE, &dest_url,
+ "CALLBACK: ",
+ "NT: upnp:event",
+ "TIMEOUT: Second-", timeout_str );
}
if( return_code != 0 ) {
return return_code;
diff --git a/upnp/src/gena/gena_device.c b/upnp/src/gena/gena_device.c
index f9b67c9..7aefcc6 100644
--- a/upnp/src/gena/gena_device.c
+++ b/upnp/src/gena/gena_device.c
@@ -219,9 +219,11 @@ notify_send_and_recv( IN uri_type * destination_url,
}
// make start line and HOST header
membuffer_init( &start_msg );
- if( http_MakeMessage( &start_msg, 1, 1,
- "q" "s",
- HTTPMETHOD_NOTIFY, &url, mid_msg->buf ) != 0 ) {
+ if (http_MakeMessage(
+ &start_msg, 1, 1,
+ "q" "s",
+ HTTPMETHOD_NOTIFY, &url,
+ mid_msg->buf ) != 0 ) {
membuffer_destroy( &start_msg );
sock_destroy( &info, SD_BOTH );
return UPNP_E_OUTOF_MEMORY;
@@ -296,11 +298,12 @@ genaNotify( IN char *headers,
// make 'end' msg (the part that won't vary with the destination)
endmsg.size_inc = 30;
- if( http_MakeMessage( &mid_msg, 1, 1,
- "s" "ssc" "sdcc",
- headers,
- "SID: ", sub->sid,
- "SEQ: ", sub->ToSendEventKey ) != 0 ) {
+ if( http_MakeMessage(
+ &mid_msg, 1, 1,
+ "s" "ssc" "sdcc",
+ headers,
+ "SID: ", sub->sid,
+ "SEQ: ", sub->ToSendEventKey ) != 0 ) {
membuffer_destroy( &mid_msg );
return UPNP_E_OUTOF_MEMORY;
}
@@ -1165,10 +1168,14 @@ respond_ok( IN SOCKINFO * info,
membuffer_init( &response );
response.size_inc = 30;
- if( http_MakeMessage( &response, major, minor,
- "R" "D" "S" "N" "Xc" "ssc" "sc" "c",
- HTTP_OK, (off_t)0, X_USER_AGENT,
- "SID: ", sub->sid, timeout_str ) != 0 ) {
+ if( http_MakeMessage(
+ &response, major, minor,
+ "R" "D" "S" "N" "Xc" "ssc" "scc",
+ HTTP_OK,
+ (off_t)0,
+ X_USER_AGENT,
+ "SID: ", sub->sid,
+ timeout_str ) != 0 ) {
membuffer_destroy( &response );
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
return UPNP_E_OUTOF_MEMORY;
diff --git a/upnp/src/genlib/net/http/httpreadwrite.c b/upnp/src/genlib/net/http/httpreadwrite.c
index 3e39ff9..54f273f 100644
--- a/upnp/src/genlib/net/http/httpreadwrite.c
+++ b/upnp/src/genlib/net/http/httpreadwrite.c
@@ -640,10 +640,11 @@ http_Download( IN const char *url_str,
"HOSTNAME : %s Length : %d\n", hoststr, hostlen );
)
- ret_code = http_MakeMessage( &request, 1, 1, "QsbcDCUc",
- HTTPMETHOD_GET, url.pathquery.buff,
- url.pathquery.size, "HOST: ", hoststr,
- hostlen );
+ ret_code = http_MakeMessage(
+ &request, 1, 1,
+ "QsbcDCUc",
+ HTTPMETHOD_GET, url.pathquery.buff, url.pathquery.size,
+ "HOST: ", hoststr, hostlen );
if( ret_code != 0 ) {
DBGONLY( UpnpPrintf
( UPNP_INFO, HTTP, __FILE__, __LINE__,
@@ -796,21 +797,27 @@ MakePostMessage( const char *url_str,
)
if( contentLength >= 0 ) {
- ret_code = http_MakeMessage( request, 1, 1, "QsbcDCUTNc",
- HTTPMETHOD_POST, url->pathquery.buff,
- url->pathquery.size, "HOST: ",
- hoststr, hostlen, contentType,
- contentLength );
+ ret_code = http_MakeMessage(
+ request, 1, 1,
+ "QsbcDCUTNc",
+ HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
+ "HOST: ", hoststr, hostlen,
+ contentType,
+ (off_t)contentLength );
} else if( contentLength == UPNP_USING_CHUNKED ) {
- ret_code = http_MakeMessage( request, 1, 1, "QsbcDCUTKc",
- HTTPMETHOD_POST, url->pathquery.buff,
- url->pathquery.size, "HOST: ",
- hoststr, hostlen, contentType );
+ ret_code = http_MakeMessage(
+ request, 1, 1,
+ "QsbcDCUTKc",
+ HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
+ "HOST: ", hoststr, hostlen,
+ contentType );
} else if( contentLength == UPNP_UNTIL_CLOSE ) {
- ret_code = http_MakeMessage( request, 1, 1, "QsbcDCUTc",
- HTTPMETHOD_POST, url->pathquery.buff,
- url->pathquery.size, "HOST: ",
- hoststr, hostlen, contentType );
+ ret_code = http_MakeMessage(
+ request, 1, 1,
+ "QsbcDCUTc",
+ HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
+ "HOST: ", hoststr, hostlen,
+ contentType );
} else {
ret_code = UPNP_E_INVALID_PARAM;
}
@@ -1131,9 +1138,11 @@ MakeGetMessage( const char *url_str,
querylen = url->pathquery.size;
}
- ret_code = http_MakeMessage( request, 1, 1, "QsbcDCUc",
- HTTPMETHOD_GET, querystr, querylen,
- "HOST: ", hoststr, hostlen );
+ ret_code = http_MakeMessage(
+ request, 1, 1,
+ "QsbcDCUc",
+ HTTPMETHOD_GET, querystr, querylen,
+ "HOST: ", hoststr, hostlen );
if( ret_code != 0 ) {
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
@@ -1729,8 +1738,11 @@ http_SendStatusResponse( IN SOCKINFO * info,
membuffer_init( &membuf );
membuf.size_inc = 70;
- ret = http_MakeMessage( &membuf, response_major, response_minor, "RSCB", http_status_code, // response start line
- http_status_code ); // body
+ ret = http_MakeMessage(
+ &membuf, response_major, response_minor,
+ "RSCB",
+ http_status_code, // response start line
+ http_status_code ); // body
if( ret == 0 ) {
timeout = HTTP_DEFAULT_TIMEOUT;
ret = http_SendMessage( info, &timeout, "b",
@@ -1770,6 +1782,7 @@ http_SendStatusResponse( IN SOCKINFO * info,
* 'C': (no args) appends a HTTP CONNECTION: close header
* depending on major,minor version
* 'N': arg1 = int content_length // content-length header
+* 'q': arg1 = http_method_t, arg2 = (uri_type *) // request start line and HOST header
* 'Q': arg1 = http_method_t; arg2 = char* url;
* arg3 = int url_length // start line of request
* 'R': arg = int status_code // adds a response start line
@@ -1777,9 +1790,7 @@ http_SendStatusResponse( IN SOCKINFO * info,
* appends content-length, content-type and HTML body for given code
* 'T': arg = char * content_type; format e.g: "text/html";
* content-type header
-* --- PATCH START - Sergey 'Jin' Bostandzhyan
-* 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent
-* --- PATCH END ---
+* 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent
*
* Return : int;
* 0 - On Success
@@ -1940,9 +1951,10 @@ http_MakeMessage( INOUT membuffer * buf,
bignum = ( off_t )va_arg( argp, off_t );
assert( bignum >= 0 );
- if( http_MakeMessage
- ( buf, http_major_version, http_minor_version, "shc",
- "CONTENT-LENGTH: ", bignum ) != 0 ) {
+ if (http_MakeMessage(
+ buf, http_major_version, http_minor_version,
+ "shc",
+ "CONTENT-LENGTH: ", bignum ) != 0 ) {
goto error_handler;
}
}
@@ -1952,14 +1964,14 @@ http_MakeMessage( INOUT membuffer * buf,
temp_str = ( c == 'S' ) ? "SERVER: " : "USER-AGENT: ";
get_sdk_info( tempbuf );
- if( http_MakeMessage
- ( buf, http_major_version, http_minor_version, "ss",
- temp_str, tempbuf ) != 0 ) {
+ if (http_MakeMessage(
+ buf, http_major_version, http_minor_version,
+ "ss",
+ temp_str, tempbuf ) != 0 ) {
goto error_handler;
}
}
-/* --- PATCH START - Sergey 'Jin' Bostandzhyan */
else if( c == 'X' ) // C string
{
s = ( char * )va_arg( argp, char * );
@@ -1974,9 +1986,6 @@ http_MakeMessage( INOUT membuffer * buf,
}
}
-/* --- PATCH END --- */
-
-
else if( c == 'R' ) {
// response start line
// e.g.: 'HTTP/1.1 200 OK'
@@ -1991,9 +2000,11 @@ http_MakeMessage( INOUT membuffer * buf,
// str
status_msg = http_get_code_text( status_code );
- if( http_MakeMessage
- ( buf, http_major_version, http_minor_version, "ssc",
- tempbuf, status_msg ) != 0 ) {
+ if (http_MakeMessage(
+ buf, http_major_version, http_minor_version,
+ "ssc",
+ tempbuf,
+ status_msg ) != 0 ) {
goto error_handler;
}
}
@@ -2010,9 +2021,12 @@ http_MakeMessage( INOUT membuffer * buf,
"