From c68f83aed45c8068daffd0d790568a1d9fe198c2 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Wed, 13 Apr 2016 02:07:29 -0400 Subject: [PATCH] [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 --- NEWS | 1 + src/mod_status.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/NEWS b/NEWS index 75be21a7..79377476 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,7 @@ NEWS * [mod_extforward] reset cond_cache for scheme (fixes #1499) * [mod_webdav] readdir POSIX compat (fixes #1826) * [mod_expire] reset caching response headers for error docs (fixes #1919) + * [mod_status] page refresh option (fixes #2170) - 1.4.39 - 2016-01-02 * [core] fix memset_s call (fixes #2698) 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" " \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("\n")); + } + } + if (p->conf.sort) { buffer_append_string_len(b, CONST_STR_LEN( "