Fix command WebSend

Fix command WebSend when using a port number as regression from 6.4.1.17 (#5304)
This commit is contained in:
Theo Arends 2019-02-22 15:19:59 +01:00
parent d219d1c9b5
commit e315be0619
2 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -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|