Project

General

Profile

Feature #2170

server-status page should have an automatic reload

Added by aalmenar over 7 years ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_status
Target version:
Start date:
2010-03-08
Due date:
% Done:

0%

Estimated time:
Missing in 1.5.x:
No

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

Associated revisions

Revision c68f83ae (diff)
Added by gstrauss over 1 year ago

[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

History

#1

Updated by gstrauss over 1 year 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" 
#2

Updated by gstrauss over 1 year ago

  • Status changed from New to Fixed

committed in c68f83ae

Also available in: Atom