Project

General

Profile

Actions

Feature #2170

closed

server-status page should have an automatic reload

Added by aalmenar almost 15 years ago. Updated over 8 years ago.

Status:
Fixed
Priority:
Normal
Category:
mod_status
Target version:
ASK QUESTIONS IN Forums:

Description

When you are monitoring directly a lighttpd server, you have to hit refresh on server-status page. This is difficult when you are looking at 10 lighttpd servers. Why not use a parameter like apache does ?

http://server-address/server-status?refresh=10

Actions #1

Updated by gstrauss over 8 years ago

  • Category set to mod_status
  • Target version set to 1.4.40
diff --git a/src/mod_status.c b/src/mod_status.c
index 90308ef..4674e93 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" 
Actions #2

Updated by gstrauss over 8 years ago

  • Status changed from New to Fixed

committed in c68f83ae

Actions

Also available in: Atom