Browse Source

[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
personal/stbuehler/mod-csrf-old
Glenn Strauss 6 years ago
parent
commit
c68f83aed4
  1. 1
      NEWS
  2. 15
      src/mod_status.c

1
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)

15
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"

Loading…
Cancel
Save