From 8ac98db5038557d50f050eb07fddc892ebcde2ab Mon Sep 17 00:00:00 2001 From: Michael Stegeman Date: Mon, 23 Nov 2020 14:49:06 -0900 Subject: [PATCH] Compare hostname in a case-insensitive manner. Fixes #126 --- ESPWebThingAdapter.h | 3 ++- EthernetWebThingAdapter.h | 2 +- SeeedWebThingAdapter.h | 3 ++- WiFi101WebThingAdapter.h | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ESPWebThingAdapter.h b/ESPWebThingAdapter.h index 9df8126..166def6 100644 --- a/ESPWebThingAdapter.h +++ b/ESPWebThingAdapter.h @@ -213,7 +213,8 @@ class WebThingAdapter { if (colonIndex >= 0) { value.remove(colonIndex); } - if (value == name + ".local" || value == ip || value == "localhost") { + if (value.equalsIgnoreCase(name + ".local") || value == ip || + value == "localhost") { return true; } request->send(403); diff --git a/EthernetWebThingAdapter.h b/EthernetWebThingAdapter.h index 1cb73ba..d9c80d6 100644 --- a/EthernetWebThingAdapter.h +++ b/EthernetWebThingAdapter.h @@ -264,7 +264,7 @@ class WebThingAdapter { if (colonIndex >= 0) { host.remove(colonIndex); } - if (host == name + ".local") { + if (host.equalsIgnoreCase(name + ".local")) { return true; } if (host == ip) { diff --git a/SeeedWebThingAdapter.h b/SeeedWebThingAdapter.h index cb96b78..13c4349 100644 --- a/SeeedWebThingAdapter.h +++ b/SeeedWebThingAdapter.h @@ -168,7 +168,8 @@ class WebThingAdapter { host.remove(colonIndex); } - if (host == name + ".local" || host == ip || host == "localhost") { + if (host.equalsIgnoreCase(name + ".local") || host == ip || + host == "localhost") { return true; } diff --git a/WiFi101WebThingAdapter.h b/WiFi101WebThingAdapter.h index f0e4a04..b2a95fc 100644 --- a/WiFi101WebThingAdapter.h +++ b/WiFi101WebThingAdapter.h @@ -250,7 +250,7 @@ class WebThingAdapter { if (colonIndex >= 0) { host.remove(colonIndex); } - if (host == name + ".local") { + if (host.equalsIgnoreCase(name + ".local")) { return true; } if (host == ip) {