From 6b2efa16dc2db38afbb543256eddb2cbf8933551 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 3 Apr 2023 14:55:47 +0200 Subject: [PATCH] Fix ESP32 WebQuery and WebGetConfig --- tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index d4cdd46c5..b6233aa92 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -3239,8 +3239,7 @@ int WebSend(char *buffer) return status; } -int WebQuery(char *buffer) -{ +int WebQuery(char *buffer) { // http://192.168.1.1/path GET -> Sends HTTP GET http://192.168.1.1/path // http://192.168.1.1/path POST {"some":"message"} -> Sends HTTP POST to http://192.168.1.1/path with body {"some":"message"} // http://192.168.1.1/path PUT [Autorization: Bearer abcdxyz] potato -> Sends HTTP PUT to http://192.168.1.1/path with authorization header and body "potato" @@ -3266,6 +3265,7 @@ int WebQuery(char *buffer) if (url && method) { #if defined(ESP32) && defined(USE_WEBCLIENT_HTTPS) if (http.begin(UrlEncode(url))) { + http.setConnectTimeout(USE_BERRY_WEBCLIENT_TIMEOUT); #else // HTTP only if (http.begin(http_client, UrlEncode(url))) { #endif @@ -3343,8 +3343,7 @@ int WebQuery(char *buffer) } #ifdef USE_WEBGETCONFIG -int WebGetConfig(char *buffer) -{ +int WebGetConfig(char *buffer) { // http://user:password@server:port/path/%id%.dmp : %id% will be expanded to MAC address int status = WEBCMND_WRONG_PARAMETERS; @@ -3357,7 +3356,8 @@ int WebGetConfig(char *buffer) #if defined(ESP32) && defined(USE_WEBCLIENT_HTTPS) HTTPClientLight http; - if (http.begin(UrlEncode(url))) { // UrlEncode(url) = |http://192.168.178.86/cm?cmnd=POWER1%20ON| + if (http.begin(UrlEncode(url))) { // UrlEncode(url) = |http://192.168.178.86/cm?cmnd=POWER1%20ON| + http.setConnectTimeout(USE_BERRY_WEBCLIENT_TIMEOUT); #else // HTTP only WiFiClient http_client; HTTPClient http;