From e315be06198ae481b102967359c886ed1e9bd6da Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 22 Feb 2019 15:19:59 +0100 Subject: [PATCH] Fix command WebSend Fix command WebSend when using a port number as regression from 6.4.1.17 (#5304) --- sonoff/_changelog.ino | 1 + sonoff/xdrv_01_webserver.ino | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 0ca38587b..d9762ec24 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -3,6 +3,7 @@ * Fix some exceptions and watchdogs due to lack of stack space - part 2 * Add command SetOption62 0/1 to disable retain on Button or Swith hold messages (#5299) * Add option WifiConfig 7 to allow reset of device in AP mode without admin password (#5297) + * Fix command WebSend when using a port number as regression from 6.4.1.17 (#5304) * * 6.4.1.17 20190214 * Change template update by removing possibility to add user module config keeping template as defined (#5222) diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 779872bb9..cb2717db3 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -2182,18 +2182,19 @@ int WebSend(char *buffer) // buffer = | [ 192.168.178.86 : 80 , admin : joker ] POWER1 ON | host = strtok_r(buffer, "]", &command); // host = | [ 192.168.178.86 : 80 , admin : joker |, command = | POWER1 ON | if (host && command) { - String url = F("http:"); // url = |http:| + String url = F("http://"); // url = |http://| host = Trim(host); // host = |[ 192.168.178.86 : 80 , admin : joker| host++; // host = | 192.168.178.86 : 80 , admin : joker| - Skip [ host = strtok_r(host, ",", &user); // host = | 192.168.178.86 : 80 |, user = | admin : joker| host = strtok_r(host, ":", &port); // host = | 192.168.178.86 |, port = | 80 | host = Trim(host); // host = |192.168.178.86| + url += host; // url = |http://192.168.178.86| + if (port) { port = Trim(port); // port = |80| - url += port; // url = |http:80| + url += F(":"); // url = |http://192.168.178.86:| + url += port; // url = |http://192.168.178.86:80| } - url += F("//"); // url = |http://| or |http:80//| - url += host; // url = |http://192.168.178.86| if (user) { user = strtok_r(user, ":", &password); // user = | admin |, password = | joker|