Skip to content

Commit 369edb6

Browse files
snosrapigrr
authored andcommitted
Case-insensitive deviceType compare and skip NOTIFY processing
* ifndef'd LWIP_OPEN_SRC to prevent a redefined warning * ABORT on NOTIFY to prevent responding to NOTIFY messages (we should only respond to M-SEARCH messages) * case-insensitive compare of _deviceType to enable response to all-lowercase Alexa queries (robustness principle)
1 parent c9dc8e1 commit 369edb6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libraries/ESP8266SSDP/ESP8266SSDP.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ License (MIT license):
2525
THE SOFTWARE.
2626
2727
*/
28+
#ifndef LWIP_OPEN_SRC
2829
#define LWIP_OPEN_SRC
30+
#endif
2931
#include <functional>
3032
#include "ESP8266SSDP.h"
3133
#include "WiFiUdp.h"
@@ -287,7 +289,6 @@ void SSDPClass::_update(){
287289
case METHOD:
288290
if(c == ' '){
289291
if(strcmp(buffer, "M-SEARCH") == 0) method = SEARCH;
290-
else if(strcmp(buffer, "NOTIFY") == 0) method = NOTIFY;
291292

292293
if(method == NONE) state = ABORT;
293294
else state = URI;
@@ -328,7 +329,7 @@ void SSDPClass::_update(){
328329
#endif
329330
}
330331
// if the search type matches our type, we should respond instead of ABORT
331-
if(strcmp(buffer, _deviceType) == 0){
332+
if(strcasecmp(buffer, _deviceType) == 0){
332333
_pending = true;
333334
_process_time = millis();
334335
state = KEY;

0 commit comments

Comments
 (0)