summaryrefslogtreecommitdiffstats
path: root/src/civetweb/test/page_status.lua
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/civetweb/test/page_status.lua
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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 000000000..3c9b0eb74
--- /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")
+