summaryrefslogtreecommitdiff
path: root/src/mod_status.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2016-04-13 02:07:29 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2016-04-13 02:08:24 -0400
commitc68f83aed45c8068daffd0d790568a1d9fe198c2 (patch)
tree298c7d6ec55914ec958dcac908a70287c0294062 /src/mod_status.c
parent760baed402d5074c990a932b781728395e657eea (diff)
downloadlighttpd-git-c68f83aed45c8068daffd0d790568a1d9fe198c2.tar.gz
[mod_status] page refresh option (fixes #2170)
e.g. http://server-address/server-status?refresh=10 x-ref: "server-status page should have an automatic reload" https://redmine.lighttpd.net/issues/2170
Diffstat (limited to 'src/mod_status.c')
-rw-r--r--src/mod_status.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mod_status.c b/src/mod_status.c
index 82326281..955554cd 100644
--- a/src/mod_status.c
+++ b/src/mod_status.c
@@ -229,6 +229,21 @@ static handler_t mod_status_handle_server_status_html(server *srv, connection *c
" span.sortarrow { color: white; text-decoration: none; }\n"
" </style>\n"));
+ if (!buffer_string_is_empty(con->uri.query) && 0 == memcmp(con->uri.query->ptr, CONST_STR_LEN("refresh="))) {
+ /* Note: Refresh is an historical, but non-standard HTTP header
+ * References (meta http-equiv="refresh" use is deprecated):
+ * https://www.w3.org/TR/WCAG10-HTML-TECHS/#meta-element
+ * https://www.w3.org/TR/WCAG10-CORE-TECHS/#auto-page-refresh
+ * https://www.w3.org/QA/Tips/reback
+ */
+ const long refresh = strtol(con->uri.query->ptr+sizeof("refresh=")-1, NULL, 10);
+ if (refresh > 0) {
+ buffer_append_string_len(b, CONST_STR_LEN("<meta http-equiv=\"refresh\" content=\""));
+ buffer_append_int(b, refresh < 604800 ? refresh : 604800);
+ buffer_append_string_len(b, CONST_STR_LEN("\">\n"));
+ }
+ }
+
if (p->conf.sort) {
buffer_append_string_len(b, CONST_STR_LEN(
"<script type=\"text/javascript\">\n"