Skip to content

Commit

Permalink
Fix command WebSend
Browse files Browse the repository at this point in the history
Fix command WebSend when using a port number as regression from 6.4.1.17 (#5304)
  • Loading branch information
arendst committed Feb 22, 2019
1 parent d219d1c commit e315be0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions sonoff/_changelog.ino
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions sonoff/xdrv_01_webserver.ino
Expand Up @@ -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|
Expand Down

0 comments on commit e315be0

Please sign in to comment.