@@ -159,30 +159,25 @@ static const char *g_wemo_eventService =
159159"</serviceStateTable>\r\n"
160160"</scpd>\r\n" ;
161161
162- static const char * g_wemo_response_1 =
162+ static const char * g_wemo_soap_response_prefix =
163163"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
164164"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
165165"<s:Body>" ;
166166
167167static const char * g_wemo_response_2_fmt =
168168"<u:%cetBinaryStateResponse xmlns:u=\"urn:Belkin:service:basicevent:1\">"
169169"<BinaryState>%i</BinaryState>"
170- "</u:%cetBinaryStateResponse>"
171- "</s:Body>"
172- "</s:Envelope>\r\n" ;
170+ "</u:%cetBinaryStateResponse>" ;
173171
174172// Minimal SOAP response templates for MetaInfo (used by /upnp/control/metainfo1)
175- static const char * g_wemo_metainfo_response_1 =
176- "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
177- "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
178- "<s:Body>" ;
179-
180173static const char * g_wemo_metainfo_response_2_fmt =
181174"<u:%sResponse xmlns:u=\"urn:Belkin:service:metainfo:1\">"
182175"<%s>%s</%s>"
183- "</u:%sResponse>"
176+ "</u:%sResponse>" ;
177+
178+ static const char * g_wemo_soap_response_suffix =
184179"</s:Body>"
185- "</s:Envelope>" ;
180+ "</s:Envelope>\r\n " ;
186181
187182// ------------------------------------------------------------
188183// Globals / stats
@@ -379,8 +374,9 @@ static int WEMO_BasicEvent1(http_request_t* request) {
379374
380375 // Always respond with the live state.
381376 http_setup (request , httpMimeTypeXML );
382- poststr (request , g_wemo_response_1 );
377+ poststr (request , g_wemo_soap_response_prefix );
383378 hprintf255 (request , g_wemo_response_2_fmt , verb , WEMO_GetMainPowerState (), verb );
379+ poststr (request , g_wemo_soap_response_suffix );
384380 poststr (request , NULL );
385381
386382 stat_eventsReceived ++ ;
@@ -408,9 +404,10 @@ static int WEMO_MetaInfo1(http_request_t* request)
408404 }
409405
410406 http_setup (request , httpMimeTypeXML );
411- poststr (request , g_wemo_metainfo_response_1 );
407+ poststr (request , g_wemo_soap_response_prefix );
412408 // Value kept intentionally simple; this endpoint is informational.
413409 hprintf255 (request , g_wemo_metainfo_response_2_fmt , action , tag , "0" , tag , action );
410+ poststr (request , g_wemo_soap_response_suffix );
414411 poststr (request , NULL );
415412 return 0 ;
416413}
0 commit comments