httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 26771] New: - Mod Status Enhancement
Date Sun, 08 Feb 2004 15:58:31 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26771>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26771

Mod Status Enhancement

           Summary: Mod Status Enhancement
           Product: Apache httpd-1.3
           Version: 1.3.27
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Other mods
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: fcartegnie@free.fr


Here's a patch that updates the mod_status (untouched since 1998).
Closed html tags, now validated html 4.01T, sortable table columns, ergonomics
(readability).

Some javascript comes from GNU licence v2. Anyones knows how to deal with this ?
(right to use ?)


diff -u apache_1.3.27/src/modules/standard/mod_status.c
apache_1.3.27_perso/src/modules/standard/mod_status.c
--- apache_1.3.27/src/modules/standard/mod_status.c	2002-03-13
22:05:34.000000000 +0100
+++ apache_1.3.27_perso/src/modules/standard/mod_status.c	2004-02-08
16:58:05.000000000 +0100
@@ -94,6 +94,8 @@
  *          extended STATUS is enabled) [George Burgyan/Jim J.]
  * 10.8.98  Allow for extended status info at runtime (no more STATUS)
  *          [Jim J.]
+ * 08.2.04  Fixed unclosed tags. Added stylesheet and javascript sorting ability
+ *          on table display. Readability enhancements [Cartegnie Francois]
  */
 
 #define CORE_PRIVATE
@@ -343,10 +345,95 @@
     ap_hard_timeout("send status info", r);
 
     if (!short_report) {
-	ap_rputs(DOCTYPE_HTML_3_2
-		 "<HTML><HEAD>\n<TITLE>Apache Status</TITLE>\n</HEAD><BODY>\n",
+	ap_rputs(DOCTYPE_HTML_4_0T
+		 "<HTML><HEAD>\n<TITLE>Apache Status</TITLE>\n",
 		 r);
-	ap_rputs("<H1>Apache Server Status for ", r);
+
+    if (!no_table_report) {
+	ap_rputs("<STYLE TYPE=\"text/css\"><!--\n\
+		BODY,TD,TH,P{font-family: Verdana, Arial, Helvetica, sans-serif;font-size:
10pt;}\n\
+		TD {background:#FFFFFF; padding:2px;}\n\
+		PRE {font-family: Courier, Courier New; letter-spacing:2pt;}\n\
+		TD.tab {text-align:center; text-decoration: underline; font-weight:
bold;border:none;}\n\
+		TD.tab:hover {text-decoration: none; cursor:pointer;}\n\
+		TABLE.stats {background:#F0F0F0; text-decoration: none; width:100%;}\n\
+		TD.numeric {text-align:right;}
+		TD.centered {text-align:center;}
+		//--></STYLE>\n",r);
+		
+
+		ap_rputs("<script type=\"text/javascript\"><!--\n\
+		var _tabLast=null;\n\
+		function _rObj (s,ar) {\n\
+		 this.s = s;\n\
+		 this.ar = ar;\n\
+		}\n\
+		function _tabCreateArray(obj,st){\n\
+			var tb=obj.parentNode.parentNode;\n\
+			var rw=obj.parentNode.parentNode.rows;\n\
+			var _nRows=rw.length;\n\
+			var _tabS=new Array(_nRows-1);\n\
+			var _nCells = rw.item(0).cells.length;\n\
+			for(var i=1;i<_nRows;i++){\n\
+				var _raw = rw.item(i).cells.item(obj.cellIndex).innerHTML;\n\
+						if (st==1) {\n\
+					_raw = _raw.replace((new RegExp('\\\\\\(','gi')), '');\n\
+				   if (_raw.indexOf(\":\") != -1) { _raw = _raw.substring(2,99); }\n\
+				 if (_raw.search(new RegExp(\"[TGMk]\",\"i\"))) {\n\
+				  if (_raw.indexOf(\"T\") != -1) { _raw = parseFloat(_raw) * 1024 * 1024 *
1024 * 1024; } \n\
+				  else {\n\
+					if (_raw.indexOf(\"G\") != -1) { _raw = parseFloat(_raw) * 1024 * 1024 *
1024; } \n\
+					else {\n\
+						 if (_raw.indexOf(\"M\") != -1) { _raw = parseFloat(_raw) * 1024 * 1024;
} \n\
+						 else {\n\
+							if (_raw.indexOf(\"k\") != -1) { _raw = parseFloat(_raw) * 1024; }\n\
+						 }\n\
+					}\n\
+			      }\n\
+				}}\n\
+					_tabS[i-1]= new _rObj(_raw,rw.item(i).cloneNode(true));\n\
+			}\n\
+			if (st==1) { _tabS.sort(_cmpFloat); }\n\
+			else { _tabS.sort(_cmpTxt); }\n\
+			if (!_tabMode) {_tabS.reverse()}			\n\
+			for(var i=0;i<_nRows-1;i++){\n\
+					var tr = _tabS[i].ar.cloneNode(true);\n\
+					var oChild=tb.rows.item(i+1);\n\
+					if (i % 2 == 0) { tr.className = 'dl-1'; } \n\
+				               else { tr.className = 'dl-2'; }\n\
+					tb.replaceChild(tr,oChild);\n\
+			}\n\
+		\n\
+		}\n\
+		function _cmpTxt(a,b) {\n\
+			if (_tabMode) {\n\
+				if (a.s==\"\") { if (b.s !=\"\") { return 1;} }\n\
+				if (b.s==\"\") { if (a.s !=\"\") { return -1;} }\n\
+			}\n\
+			if (a.s.toUpperCase() < b.s.toUpperCase()) {return -1;}\n\
+			if (a.s.toUpperCase() > b.s.toUpperCase()) {return 1;}\n\
+			return 0;\n\
+		}\n\
+		function _cmpFloat(a,b) {\n\
+			if (!_tabMode) {\n\
+				if (a.s==\"\") { if (b.s !=\"\") { return -1;} }\n\
+				if (b.s==\"\") { if (a.s !=\"\") { return 1;} }\n\
+			}\n\
+			if (isNaN(parseFloat(a.s))) {return 1;}\n\
+			if (isNaN(parseFloat(b.s))) {return -1;}\n\
+			return (parseFloat(b.s) - parseFloat(a.s));\n\
+		}\n\
+		function _tabSort(obj,st){\n\
+			if (_tabLast==obj) {_tabMode=!(_tabMode);} \n\
+			else {_tabMode=true;}\n\
+			_tabCreateArray(obj,st);\n\
+			_tabLast=obj;\n\
+			return _tabMode;\n\
+		}\n\
+		//--></script>\n", r);
+    }
+        
+	ap_rputs("</HEAD><BODY>\n<H1>Apache Server Status for ", r);
 	ap_rvputs(r, ap_get_server_name(r), "</H1>\n\n", NULL);
 	ap_rvputs(r, "Server Version: ",
 	  ap_get_server_version(), "<br>\n", NULL);
@@ -448,7 +535,7 @@
 	ap_rputs("\n", r);
     else {
 	ap_rputs("</PRE>\n", r);
-	ap_rputs("Scoreboard Key: <br>\n", r);
+	ap_rputs("<P>Scoreboard Key: <br>\n", r);
 	ap_rputs("\"<B><code>_</code></B>\" Waiting for Connection, \n",
r);
 	ap_rputs("\"<B><code>S</code></B>\" Starting up, \n", r);
 	ap_rputs("\"<B><code>R</code></B>\" Reading Request,<BR>\n",
r);
@@ -457,8 +544,8 @@
 	ap_rputs("\"<B><code>D</code></B>\" DNS Lookup,<BR>\n", r);
 	ap_rputs("\"<B><code>L</code></B>\" Logging, \n", r);
 	ap_rputs("\"<B><code>G</code></B>\" Gracefully finishing, \n", r);
-	ap_rputs("\"<B><code>.</code></B>\" Open slot with no current process<P>\n",
r);
-	ap_rputs("<P>\n", r);
+	ap_rputs("\"<B><code>.</code></B>\" Open slot with no current process\n",
r);
+	ap_rputs("</P>\n", r);
 	if (!ap_extended_status) {
 	    int j = 0;
 	    ap_rputs("PID Key: <br>\n", r);
@@ -482,13 +569,13 @@
     if (ap_extended_status) {
 	if (!short_report) {
 	    if (no_table_report)
-		ap_rputs("<p><hr><h2>Server Details</h2>\n\n", r);
+		ap_rputs("<p><hr><h2>Server Details</h2>\n\n</p>", r);
 	    else
 #ifdef NO_TIMES
 		/* Allow for OS/2 not having CPU stats */
-		ap_rputs("<p>\n\n<table
border=0><tr><th>Srv<th>PID<th>Acc<th>M\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client<th>VHost<th>Request</tr>\n\n",
r);
+		ap_rputs("<p>\n\n<table class=\"stats\"><tr><td class=\"tab\"
onClick=\"_tabSort(this,0);\">Srv</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">PID</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">Acc</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">M\n</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">SS</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">Req</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">Conn</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">Child</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">Slot</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">Client</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">VHost</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">Request</td></tr>\n\n", r);
 #else
-		ap_rputs("<p>\n\n<table
border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client<th>VHost<th>Request</tr>\n\n",
r);
+		ap_rputs("<p>\n\n<table class=\"stats\"><tr><td class=\"tab\"
onClick=\"_tabSort(this,0);\">Srv</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">PID</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">Acc</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">M</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">CPU\n</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">SS</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">Req</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">Conn</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">Child</td><td class=\"tab\"
onClick=\"_tabSort(this,1);\">Slot</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">Client</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">VHost</td><td class=\"tab\"
onClick=\"_tabSort(this,0);\">Request</td></tr>\n\n", r);
 #endif
 	}
 
@@ -609,53 +696,53 @@
 		    else {		/* !no_table_report */
 			if (score_record.status == SERVER_DEAD)
 			    ap_rprintf(r,
-				"<tr><td><b>%d-%d</b><td>-<td>%d/%lu/%lu",
+				"<tr><td class=\"numeric\"><b>%d-%d</b></td><td class=\"numeric\">-</td><td
class=\"numeric\">%d/%lu/%lu</td>",
 				i, (int) ps_record.generation,
 				(int) conn_lres, my_lres, lres);
 			else
 			    ap_rprintf(r,
-				"<tr><td><b>%d-%d</b><td>%d<td>%d/%lu/%lu",
+				"<tr><td class=\"numeric\"><b>%d-%d</b></td><td
class=\"numeric\">%d</td><td class=\"numeric\">%d/%lu/%lu</td>",
 				i, (int) ps_record.generation,
 				(int) ps_record.pid, (int) conn_lres,
 				my_lres, lres);
 
 			switch (score_record.status) {
 			case SERVER_READY:
-			    ap_rputs("<td>_", r);
+			    ap_rputs("<td class=\"centered\">_</td>", r);
 			    break;
 			case SERVER_STARTING:
-			    ap_rputs("<td><b>S</b>", r);
+			    ap_rputs("<td class=\"centered\"><b>S</b></td>", r);
 			    break;
 			case SERVER_BUSY_READ:
-			    ap_rputs("<td><b>R</b>", r);
+			    ap_rputs("<td class=\"centered\"><b>R</b></td>", r);
 			    break;
 			case SERVER_BUSY_WRITE:
-			    ap_rputs("<td><b>W</b>", r);
+			    ap_rputs("<td class=\"centered\"><b>W</b></td>", r);
 			    break;
 			case SERVER_BUSY_KEEPALIVE:
-			    ap_rputs("<td><b>K</b>", r);
+			    ap_rputs("<td class=\"centered\"><b>K</b></td>", r);
 			    break;
 			case SERVER_BUSY_LOG:
-			    ap_rputs("<td><b>L</b>", r);
+			    ap_rputs("<td class=\"centered\"><b>L</b></td>", r);
 			    break;
 			case SERVER_BUSY_DNS:
-			    ap_rputs("<td><b>D</b>", r);
+			    ap_rputs("<td class=\"centered\"><b>D</b></td>", r);
 			    break;
 			case SERVER_DEAD:
-			    ap_rputs("<td>.", r);
+			    ap_rputs("<td class=\"centered\">.</td>", r);
 			    break;
 			case SERVER_GRACEFUL:
-			    ap_rputs("<td>G", r);
+			    ap_rputs("<td class=\"centered\">G</td>", r);
 			    break;
 			default:
-			    ap_rputs("<td>?", r);
+			    ap_rputs("<td class=\"centered\">?</td>", r);
 			    break;
 			}
 #ifdef NO_TIMES
 			/* Allow for OS/2 not having CPU stats */
-			ap_rprintf(r, "\n<td>%.0f<td>%ld",
+			ap_rprintf(r, "\n<td class=\"numeric\">%.0f</td><td class=\"numeric\">%ld</td>",
 #else
-			ap_rprintf(r, "\n<td>%.2f<td>%.0f<td>%ld",
+			ap_rprintf(r, "\n<td class=\"numeric\">%.2f</td><td
class=\"numeric\">%.0f</td><td class=\"numeric\">%ld</td>",
 			    (score_record.times.tms_utime +
 			     score_record.times.tms_stime +
 			     score_record.times.tms_cutime +
@@ -667,15 +754,15 @@
 			    difftime(nowtime, score_record.last_used),
 #endif
 			    (long) req_time);
-			ap_rprintf(r, "<td>%-1.1f<td>%-2.2f<td>%-2.2f\n",
+			ap_rprintf(r, "<td class=\"numeric\">%-1.1f</td><td
class=\"numeric\">%-2.2f</td><td class=\"numeric\">%-2.2f</td>\n",
 			   (float) conn_bytes / KBYTE, (float) my_bytes / MBYTE,
 			    (float) bytes / MBYTE);
 			if (score_record.status == SERVER_BUSY_READ)
 			    ap_rprintf(r,
-			     "<td>?<td nowrap>?<td nowrap>..reading.. </tr>\n\n");
+			     "<td class=\"centered\">?</td><td class=\"centered\" nowrap>?</td><td
nowrap>..reading.. </td></tr>\n\n");
 			else
 			    ap_rprintf(r,
-			     "<td>%s<td nowrap>%s<td nowrap>%s</tr>\n\n",
+			     "<td class=\"centered\">%s</td><td class=\"centered\" nowrap>%s</td><td
nowrap>%s</td></tr>\n\n",
 			     ap_escape_html(r->pool, score_record.client),
 			     vhost ? ap_escape_html(r->pool, 
 				vhost->server_hostname) : "(unavailable)",
@@ -687,33 +774,33 @@
 
 	if (!(short_report || no_table_report)) {
 #ifdef NO_TIMES
-	    ap_rputs("</table>\n \
+	    ap_rputs("</table></p>\n \
 <hr> \
 <table>\n \
-<tr><th>Srv<td>Child Server number - generation\n \
-<tr><th>PID<td>OS process ID\n \
-<tr><th>Acc<td>Number of accesses this connection / this child / this slot\n
\
-<tr><th>M<td>Mode of operation\n \
-<tr><th>SS<td>Seconds since beginning of most recent request\n \
-<tr><th>Req<td>Milliseconds required to process most recent request\n \
-<tr><th>Conn<td>Kilobytes transferred this connection\n \
-<tr><th>Child<td>Megabytes transferred this child\n \
-<tr><th>Slot<td>Total megabytes transferred this slot\n \
+<tr><th>Srv</th><td>Child Server number - generation</td></tr>\n
\
+<tr><th>PID</th><td>OS process ID</td></tr>\n \
+<tr><th>Acc</th><td>Number of accesses this connection / this child
/ this
slot</td></tr>\n \
+<tr><th>M</th><td>Mode of operation</td></tr>\n \
+<tr><th>SS</th><td>Seconds since beginning of most recent request</td></tr>\n
\
+<tr><th>Req</th><td>Milliseconds required to process most recent
request</td></tr>\n \
+<tr><th>Conn</th><td>Kilobytes transferred this connection</td></tr>\n
\
+<tr><th>Child</th><td>Megabytes transferred this child</td></tr>\n
\
+<tr><th>Slot</th><td>Total megabytes transferred this slot</td></tr>\n
\
 </table>\n", r);
 #else
 	    ap_rputs("</table>\n \
 <hr> \
 <table>\n \
-<tr><th>Srv<td>Child Server number - generation\n \
-<tr><th>PID<td>OS process ID\n \
-<tr><th>Acc<td>Number of accesses this connection / this child / this slot\n
\
-<tr><th>M<td>Mode of operation\n \
-<tr><th>CPU<td>CPU usage, number of seconds\n \
-<tr><th>SS<td>Seconds since beginning of most recent request\n \
-<tr><th>Req<td>Milliseconds required to process most recent request\n \
-<tr><th>Conn<td>Kilobytes transferred this connection\n \
-<tr><th>Child<td>Megabytes transferred this child\n \
-<tr><th>Slot<td>Total megabytes transferred this slot\n \
+<tr><th>Srv</th><td>Child Server number - generation</td></tr>\n
\
+<tr><th>PID</th><td>OS process ID</td></tr>\n \
+<tr><th>Acc</th><td>Number of accesses this connection / this child
/ this
slot</td></tr>\n \
+<tr><th>M</th><td>Mode of operation</td></tr>\n \
+<tr><th>CPU</th><td>CPU usage, number of seconds</td></tr>\n
\
+<tr><th>SS</th><td>Seconds since beginning of most recent request</td></tr>\n
\
+<tr><th>Req</th><td>Milliseconds required to process most recent
request</td></tr>\n \
+<tr><th>Conn</th><td>Kilobytes transferred this connection</td></tr>\n
\
+<tr><th>Child</th><td>Megabytes transferred this child</td></tr>\n
\
+<tr><th>Slot</th><td>Total megabytes transferred this slot</td></tr>\n
\
 </table>\n", r);
 #endif
 	}

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message