diff --git a/files/www/cgi-bin/iperf b/files/www/cgi-bin/iperf index 3d07caf1..e5c6c59d 100755 --- a/files/www/cgi-bin/iperf +++ b/files/www/cgi-bin/iperf @@ -35,28 +35,29 @@ --]] require("uci") -require("aredn.http") require("luci.sys") -require("aredn.html") local q = os.getenv("QUERY_STRING") or "" local server = q:match("server=([^&]*)") local protocol = q:match("protocol=([^&]*)") or "tcp" -http_header(true) + +print "Content-type: text/html\r" +print "Cache-Control: no-store\r" +print("Access-Control-Allow-Origin: *\r") +print("\r") if uci.cursor():get("aredn", "@iperf[0]", "enable") == "0" then - aredn.html.print("
iperf is disabled") + print("
iperf is disabled") elseif not server then - aredn.html.print("
Provide a server name to run a test between this client and a server [/cgi-bin/iperf?server=<ServerName>&protocol=<udp|tcp>]") + print("
Provide a server name to run a test between this client and a server [/cgi-bin/iperf?server=<ServerName>&protocol=<udp|tcp>]") elseif server == "" then os.execute("killall iperf3; iperf3 -s -D -1") - aredn.html.print("
iperf server running (one time)") + print("
iperf server running (one time)") elseif server:match("[^%w-%.]") then - aredn.html.print("
Illegal server name") + print("
Illegal server name") else if not server:match("%.") then server = server .. ".local.mesh" end luci.sys.httpget("http://" .. server .. ":8080/cgi-bin/iperf?server=") - aredn.html.print("
" .. io.popen("/usr/bin/iperf3 -b 0 -c " .. server .. (protocol == "udp" and " -u" or "") .. " 2>&1"):read("*a") .. "") + print("
" .. io.popen("/usr/bin/iperf3 -b 0 -c " .. server .. (protocol == "udp" and " -u" or "") .. " 2>&1"):read("*a") .. "") end -http_footer()