mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
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)
This commit is contained in:
parent
c9dc8e1717
commit
369edb616d
@ -25,7 +25,9 @@ License (MIT license):
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
#ifndef LWIP_OPEN_SRC
|
||||||
#define LWIP_OPEN_SRC
|
#define LWIP_OPEN_SRC
|
||||||
|
#endif
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "ESP8266SSDP.h"
|
#include "ESP8266SSDP.h"
|
||||||
#include "WiFiUdp.h"
|
#include "WiFiUdp.h"
|
||||||
@ -287,7 +289,6 @@ void SSDPClass::_update(){
|
|||||||
case METHOD:
|
case METHOD:
|
||||||
if(c == ' '){
|
if(c == ' '){
|
||||||
if(strcmp(buffer, "M-SEARCH") == 0) method = SEARCH;
|
if(strcmp(buffer, "M-SEARCH") == 0) method = SEARCH;
|
||||||
else if(strcmp(buffer, "NOTIFY") == 0) method = NOTIFY;
|
|
||||||
|
|
||||||
if(method == NONE) state = ABORT;
|
if(method == NONE) state = ABORT;
|
||||||
else state = URI;
|
else state = URI;
|
||||||
@ -328,7 +329,7 @@ void SSDPClass::_update(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// if the search type matches our type, we should respond instead of ABORT
|
// if the search type matches our type, we should respond instead of ABORT
|
||||||
if(strcmp(buffer, _deviceType) == 0){
|
if(strcasecmp(buffer, _deviceType) == 0){
|
||||||
_pending = true;
|
_pending = true;
|
||||||
_process_time = millis();
|
_process_time = millis();
|
||||||
state = KEY;
|
state = KEY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user