set 10 sectimeout for http requests

This commit is contained in:
MichaelDvP
2026-07-12 17:17:07 +02:00
parent cb1cb356ce
commit 2b25ae18d1
4 changed files with 7 additions and 2 deletions

View File

@@ -728,6 +728,8 @@ std::string compute(const std::string & expr) {
}
if (url.substr(0, 4) == "http") { // match http and https
HTTPClient * http = new HTTPClient;
http->setConnectTimeout(10000);
http->setTimeout(10000);
if (http->begin(url.c_str())) {
int httpResult = 0;
for (JsonPair p : doc[header_s].as<JsonObject>()) {

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.8.3-dev.8d"
#define EMSESP_APP_VERSION "3.8.3-dev.8e"

View File

@@ -355,7 +355,9 @@ bool WebSchedulerService::command(const char * name, const std::string & command
JsonDocument doc;
if (deserializeJson(doc, cmd) == DeserializationError::Ok) {
HTTPClient * http = new HTTPClient;
std::string url = doc["url"] | "";
http->setConnectTimeout(10000);
http->setTimeout(10000);
std::string url = doc["url"] | "";
// for a GET with parameters replace commands with values
// don't search the complete url, it may contain a devicename in path
auto q = url.find_first_of('?');