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, "" ); bignum = strlen( tempbuf ); - if( http_MakeMessage( buf, http_major_version, http_minor_version, "NTcs", bignum, // content-length - "text/html", // content-type - tempbuf ) != 0 ) // body + if (http_MakeMessage( + buf, http_major_version, http_minor_version, + "NTcs", + bignum, // content-length + "text/html", // content-type + tempbuf ) != 0 ) // body { goto error_handler; } @@ -2021,17 +2035,18 @@ http_MakeMessage( INOUT membuffer * buf, else if( c == 'Q' ) { // request start line // GET /foo/bar.html HTTP/1.1\r\n - // method = ( http_method_t ) va_arg( argp, http_method_t ); method_str = method_to_str( method ); url_str = ( const char * )va_arg( argp, const char * ); num = ( int )va_arg( argp, int ); // length of url_str - if( http_MakeMessage( buf, http_major_version, http_minor_version, "ssbsdsdc", method_str, // method - " ", url_str, num, // url - " HTTP/", http_major_version, ".", - http_minor_version ) != 0 ) { + if (http_MakeMessage( + buf, http_major_version, http_minor_version, + "ssbsdsdc", + method_str, // method + " ", url_str, num, // url + " HTTP/", http_major_version, ".", http_minor_version ) != 0 ) { goto error_handler; } } @@ -2048,10 +2063,11 @@ http_MakeMessage( INOUT membuffer * buf, goto error_handler; } - if( http_MakeMessage - ( buf, http_major_version, http_minor_version, "Q" "sbc", - method, url.pathquery.buff, url.pathquery.size, "HOST: ", - url.hostport.text.buff, url.hostport.text.size ) != 0 ) { + if (http_MakeMessage( + buf, http_major_version, http_minor_version, + "Q" "sbc", + method, url.pathquery.buff, url.pathquery.size, + "HOST: ", url.hostport.text.buff, url.hostport.text.size ) != 0 ) { goto error_handler; } } @@ -2060,9 +2076,10 @@ http_MakeMessage( INOUT membuffer * buf, // content type header temp_str = ( const char * )va_arg( argp, const char * ); // type/subtype format - if( http_MakeMessage - ( buf, http_major_version, http_minor_version, "ssc", - "CONTENT-TYPE: ", temp_str ) != 0 ) { + if (http_MakeMessage( + buf, http_major_version, http_minor_version, + "ssc", + "CONTENT-TYPE: ", temp_str ) != 0 ) { goto error_handler; } } @@ -2186,16 +2203,13 @@ MakeGetMessageEx( const char *url_str, hostlen ); ) - errCode = http_MakeMessage( request, - 1, - 1, - "QsbcGDCUc", - HTTPMETHOD_GET, - url->pathquery.buff, - url->pathquery.size, - "HOST: ", - hoststr, - hostlen, pRangeSpecifier ); + errCode = http_MakeMessage( + request, 1, 1, + "QsbcGDCUc", + HTTPMETHOD_GET, + url->pathquery.buff, url->pathquery.size, + "HOST: ", hoststr, hostlen, + pRangeSpecifier ); if( errCode != 0 ) { DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, diff --git a/upnp/src/genlib/net/http/webserver.c b/upnp/src/genlib/net/http/webserver.c index 1024700..0e7a0c8 100644 --- a/upnp/src/genlib/net/http/webserver.c +++ b/upnp/src/genlib/net/http/webserver.c @@ -1377,21 +1377,19 @@ process_request( IN http_message_t * req, if( RespInstr->IsRangeActive && RespInstr->IsChunkActive ) { -/* - PATCH START - Sergey 'Jin' Bostandzhyan - * added X-User-Agent header - */ - //Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT //Transfer-Encoding: chunked // K means add chunky header ang G means range header. - if( http_MakeMessage( headers, resp_major, resp_minor, "RTGKDstcSXcCc", HTTP_PARTIAL_CONTENT, // status code - // RespInstr->ReadSendSize,// content length - finfo.content_type, - // content_type.buf, // content type - RespInstr, // Range - "LAST-MODIFIED: ", - &finfo.last_modified, - X_USER_AGENT) != 0 ) { + if (http_MakeMessage( + headers, resp_major, resp_minor, + "RTGKDstcSXcCc", + HTTP_PARTIAL_CONTENT, // status code + // RespInstr->ReadSendSize,// content length + finfo.content_type, + // content_type.buf, // content type + RespInstr, // Range + "LAST-MODIFIED: ", &finfo.last_modified, + X_USER_AGENT) != 0 ) { goto error_handler; } } else if( RespInstr->IsRangeActive && !RespInstr->IsChunkActive ) { @@ -1399,14 +1397,16 @@ process_request( IN http_message_t * req, //Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT //Transfer-Encoding: chunked // K means add chunky header ang G means range header. - if( http_MakeMessage( headers, resp_major, resp_minor, "RNTGDstcSXcCc", HTTP_PARTIAL_CONTENT, // status code - RespInstr->ReadSendSize, // content length - finfo.content_type, - //content_type.buf, // content type - RespInstr, //Range Info - "LAST-MODIFIED: ", - &finfo.last_modified, - X_USER_AGENT) != 0 ) { + if (http_MakeMessage( + headers, resp_major, resp_minor, + "RNTGDstcSXcCc", + HTTP_PARTIAL_CONTENT, // status code + (off_t)RespInstr->ReadSendSize, // content length + finfo.content_type, + //content_type.buf, // content type + RespInstr, //Range Info + "LAST-MODIFIED: ", &finfo.last_modified, + X_USER_AGENT) != 0 ) { goto error_handler; } @@ -1415,46 +1415,51 @@ process_request( IN http_message_t * req, //Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT //Transfer-Encoding: chunked // K means add chunky header ang G means range header. - if( http_MakeMessage( headers, resp_major, resp_minor, "RKTDstcSXcCc", HTTP_OK, // status code - //RespInstr->ReadSendSize,// content length - finfo.content_type, - // content_type.buf, // content type - "LAST-MODIFIED: ", - &finfo.last_modified, - X_USER_AGENT) != 0 ) { + if (http_MakeMessage( + headers, resp_major, resp_minor, + "RKTDstcSXcCc", + HTTP_OK, // status code + //RespInstr->ReadSendSize, // content length + finfo.content_type, + // content_type.buf, // content type + "LAST-MODIFIED: ", &finfo.last_modified, + X_USER_AGENT) != 0 ) { goto error_handler; } } else { - if( RespInstr->ReadSendSize >= 0 ) { + if (RespInstr->ReadSendSize >= 0) { //Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT //Transfer-Encoding: chunked // K means add chunky header ang G means range header. - if( http_MakeMessage( headers, resp_major, resp_minor, "RNTDstcSXcCc", HTTP_OK, // status code - RespInstr->ReadSendSize, // content length - finfo.content_type, - //content_type.buf, // content type - "LAST-MODIFIED: ", - &finfo.last_modified, - X_USER_AGENT) != 0 ) { + if (http_MakeMessage( + headers, resp_major, resp_minor, + "RNTDstcSXcCc", + HTTP_OK, // status code + (off_t)RespInstr->ReadSendSize, // content length + finfo.content_type, + //content_type.buf, // content type + "LAST-MODIFIED: ", &finfo.last_modified, + X_USER_AGENT) != 0 ) { goto error_handler; } } else { //Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT //Transfer-Encoding: chunked // K means add chunky header ang G means range header. - if( http_MakeMessage( headers, resp_major, resp_minor, "RTDstcSXcCc", HTTP_OK, // status code - //RespInstr->ReadSendSize,// content length - finfo.content_type, - //content_type.buf, // content type - "LAST-MODIFIED: ", - &finfo.last_modified, - X_USER_AGENT) != 0 ) { + if (http_MakeMessage( + headers, resp_major, resp_minor, + "RTDstcSXcCc", + HTTP_OK, // status code + //RespInstr->ReadSendSize,// content length + finfo.content_type, + //content_type.buf, // content type + "LAST-MODIFIED: ", &finfo.last_modified, + X_USER_AGENT) != 0 ) { goto error_handler; } } } -/* -- PATCH END -- */ if( req->method == HTTPMETHOD_HEAD ) { *rtype = RESP_HEADERS; @@ -1738,12 +1743,12 @@ web_server_callback( IN http_parser_t * parser, &RespInstr ); //Send response. -/* - PATCH START - Sergey 'Jin' Bostandzhyan - * added X-User-Agent header - */ - http_MakeMessage( &headers, 1, 1, "RTDSXcCc", ret, - "text/html", X_USER_AGENT ); -/* - PATCH END --- */ + http_MakeMessage( + &headers, 1, 1, + "RTDSXcCc", + ret, + "text/html", + X_USER_AGENT ); http_SendMessage( info, &timeout, "b", headers.buf, headers.length ); diff --git a/upnp/src/soap/soap_ctrlpt.c b/upnp/src/soap/soap_ctrlpt.c index 09bbb39..09a9cf8 100644 --- a/upnp/src/soap/soap_ctrlpt.c +++ b/upnp/src/soap/soap_ctrlpt.c @@ -601,9 +601,9 @@ SoapSendAction( IN char *action_url, char *upnp_error_str; xboolean got_response = FALSE; + off_t content_length; char *xml_start = -// "\n" required?? - "\n" ""; char *xml_end = "\n" "\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 = -// "\n" required?? "\n"; char *xml_body_start = ""; @@ -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 = // "\n" required?? " */ - 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 = -// "\n" required?? "\n" @@ -297,19 +295,18 @@ send_var_query_response( IN SOCKINFO * info, // make headers membuffer_init( &response ); -/* -- PATCH START - Sergey 'Jin' Bostandzhyan */ - 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 */ - 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", diff --git a/upnp/src/ssdp/ssdp_device.c b/upnp/src/ssdp/ssdp_device.c index 9f74838..d367b0d 100644 --- a/upnp/src/ssdp/ssdp_device.c +++ b/upnp/src/ssdp/ssdp_device.c @@ -295,16 +295,16 @@ CreateServicePacket( IN int msg_type, *packet = NULL; if( msg_type == MSGTYPE_REPLY ) { -/* -- PATCH START - Sergey 'Jin' Bostandzhyan */ - ret_code = http_MakeMessage( &buf, 1, 1, - "R" "sdc" "D" "s" "ssc" "S" "Xc" "ssc" - "ssc" "c", HTTP_OK, - "CACHE-CONTROL: max-age=", duration, - "EXT:\r\n", "LOCATION: ", location, - X_USER_AGENT, - "ST: ", nt, "USN: ", usn ); -/* -- PATCH END - */ - + ret_code = http_MakeMessage( + &buf, 1, 1, + "R" "sdc" "D" "sc" "ssc" "S" "Xc" "ssc" "sscc", + HTTP_OK, + "CACHE-CONTROL: max-age=", duration, + "EXT:", + "LOCATION: ", location, + X_USER_AGENT, + "ST: ", nt, + "USN: ", usn); if( ret_code != 0 ) { return; } @@ -320,15 +320,17 @@ CreateServicePacket( IN int msg_type, // NOTE: The CACHE-CONTROL and LOCATION headers are not present in // a shutdown msg, but are present here for MS WinMe interop. -/* -- PATCH START - Sergey 'Jin' Bostandzhyan */ - ret_code = http_MakeMessage( &buf, 1, 1, - "Q" "sssdc" "sdc" "ssc" "ssc" "ssc" - "S" "Xc" "ssc" "c", HTTPMETHOD_NOTIFY, "*", - 1, "HOST: ", SSDP_IP, ":", SSDP_PORT, - "CACHE-CONTROL: max-age=", duration, - "LOCATION: ", location, "NT: ", nt, - "NTS: ", nts, X_USER_AGENT, "USN: ", usn ); -/* -- PATCH END - */ + ret_code = http_MakeMessage( + &buf, 1, 1, + "Q" "sssdc" "sdc" "ssc" "ssc" "ssc" "S" "Xc" "sscc", + HTTPMETHOD_NOTIFY, "*", + 1, "HOST: ", SSDP_IP, ":", SSDP_PORT, + "CACHE-CONTROL: max-age=", duration, + "LOCATION: ", location, + "NT: ", nt, + "NTS: ", nts, + X_USER_AGENT, + "USN: ", usn ); if( ret_code != 0 ) { return; }