summaryrefslogtreecommitdiffstats
path: root/src/civetweb/test/page_status.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/civetweb/test/page_status.lua')
-rw-r--r--src/civetweb/test/page_status.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/civetweb/test/page_status.lua b/src/civetweb/test/page_status.lua
new file mode 100644
index 00000000..3c9b0eb7
--- /dev/null
+++ b/src/civetweb/test/page_status.lua
@@ -0,0 +1,38 @@
+mg.write("HTTP/1.0 200 OK\r\n")
+
+-- MIME type: https://www.ietf.org/rfc/rfc4627.txt, chapter 6
+mg.write("Content-Type: application/json\r\n")
+
+mg.write("\r\n")
+
+num_threads = mg.get_option("num_threads")
+num_threads = tonumber(num_threads)
+
+
+function n(s)
+ if ((type(s) == "string") and (#s > 0)) then
+ return s
+ else
+ return "null"
+ end
+end
+
+
+mg.write("{\r\n\"system\" :\r\n")
+
+mg.write(n(mg.get_info("system")))
+
+mg.write(",\r\n\"summary\" :\r\n")
+mg.write(n(mg.get_info("context")))
+mg.write(",\r\n\"common\" :\r\n")
+mg.write(n(mg.get_info("common")))
+mg.write(",\r\n\"connections\" :\r\n[\r\n")
+
+ mg.write(n(mg.get_info("connection", 1)))
+
+for i=2,num_threads do
+ mg.write(",\r\n")
+ mg.write(n(mg.get_info("connection", i)))
+end
+mg.write("]\r\n}\r\n")
+