Skip to content

Commit

Permalink
fixed an issue with query string parsing where the query string could
Browse files Browse the repository at this point in the history
not be properly parsed when the addon was using within a ingress proxied
connection. This fixes jens-maus/RaspberryMatic#2059
  • Loading branch information
jens-maus committed Jan 5, 2023
1 parent 8ad3a50 commit e5779df
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Empty file modified www/backup.cgi
100644 → 100755
Empty file.
Empty file modified www/config_js.cgi
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions www/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Mail.prototype =
data += this.m_content;

var result = "AJAX error";
try { result = http.post(Mail.URL + '?sid=' + SessionId + '&mail', data); }
try { result = http.post(Mail.URL + '?sid=' + SessionId + '&cmd=mail', data); }
catch (ex) { }
if ("OK" == result) { alert("E-Mail wurde erfolgreich gespeichert!"); }
else { alert("Fehler beim Speichern der E-Mail (" + result + ")!"); }
Expand Down Expand Up @@ -414,7 +414,7 @@ Account =
data += "\n";

var result = "AJAX error";
try { result = http.post(Account.URL + '?sid='+SessionId+'&account', data); }
try { result = http.post(Account.URL + '?sid='+SessionId+'&cmd=account', data); }
catch (ex) { }
if ("OK" == result) { alert("Kontodaten wurden erfolgreich gespeichert!"); }
else { alert("Fehler beim Speichern der Kontodaten (" + result + ")!"); }
Expand Down Expand Up @@ -459,7 +459,7 @@ Tcl =
data += $("userScriptTextArea").value;

var result = "AJAX error";
try { result = http.post(Tcl.URL + '?sid='+SessionId+'&userScript', data); }
try { result = http.post(Tcl.URL + '?sid='+SessionId+'&cmd=userScript', data); }
catch (ex) { }
if ("OK" == result) { alert("Tcl Script wurde erfolgreich gespeichert!"); }
else { alert("Fehler beim Speichern des Tcl Scripts (" + result + ")!"); }
Expand Down
9 changes: 4 additions & 5 deletions www/save.cgi
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ if { [info exists sid] && [check_session $sid] } {
set input $env(QUERY_STRING)
set pairs [split $input &]
foreach pair $pairs {
if {0 == [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} {
set __args(Query) $pair
break
if {0 != [regexp "cmd=(.*)" $pair dummy val]} {
set __args(cmd) $val
}
}
}
Expand Down Expand Up @@ -255,11 +254,11 @@ if { [info exists sid] && [check_session $sid] } {

__args_init

switch -exact -- [__args_get Query] {
switch -exact -- [__args_get cmd] {
mail { __saveMail }
account { __saveAccount }
userScript { __saveUserScript }
default { error "Unknown Command [__args_get Query]" }
default { error "Unknown Command [__args_get cmd]" }
}

puts -nonewline "OK"
Expand Down

0 comments on commit e5779df

Please sign in to comment.