[DNS] Fix hostByName returning negative values when lookup failed

`hostByName` does only return `1` on success, however it may return a negative value when lookup failed.
So need to check for the exact return value and not consider it a boolean return type.
This commit is contained in:
TD-er committed 2026-10-07 08:27:40 +02:00
1 parent 488cb70ba9
commit 050017b2b0
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -1173,7 +1173,7 @@ bool HTTPClientLight::connect(void)
} else {
IPAddress remote_addr;
// Add include "ESP8266WiFi.h" for this to work
if (!WiFi.hostByName(_host.c_str(), remote_addr)) {
if (Network.hostByName(_host.c_str(), remote_addr) != 1) {
return false;
}
if(!_client->connect(remote_addr, _port, _connectTimeout)) {