-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nick Kew wrote:
> On 22 Jun 2010, at 08:20, [email protected] wrote:
> 
>> Just as a hint: i posted a patch about two weeks ago, 
> 
> Pointer?  Was that somewhere in bugzilla?  I don't see it on-list.
> 
I have not opened a bug report yet. I was about to, when this thread
started.

If the outcome of this thread is, that nothing will be done, i will open
a bug report and attach the patch.

The patch is also attached to this mail for your convinience :-)

regards
volker

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwjPBEACgkQHaTGAGocg2JXggCgtX+9RZ9SPxAUlkyTeplzSngE
r2wAn2uxLbX7TYcMEmLBi/y28rEDgKk5
=QjbV
-----END PGP SIGNATURE-----
--- mod_status.c.orig	2010-06-10 16:06:48.550253580 +0200
+++ mod_status.c	2010-06-10 16:05:59.910253580 +0200
@@ -99,6 +99,20 @@
 
 module AP_MODULE_DECLARE_DATA status_module;
 
+
+
+/* custom name for ServerStatus-Handlername. Prevents
+ * htaccess users from simply Setting
+ *
+ * 'SetHandler server-status'
+ *
+ * in their htaccess-file to gain infos.
+*/
+
+typedef struct {
+  char *Handlername;
+} modstatus_config;
+
 static int server_limit, thread_limit;
 
 /* Implement 'ap_run_status_hook'. */
@@ -115,6 +129,31 @@
 static pid_t child_pid;
 #endif
 
+
+/* set the handlername defined in 
+ * serverconfig
+ */
+static const char *set_serverstatus_handler_name(cmd_parms *cmd, void *dummy, const char *arg)
+{
+  modstatus_config *s_cfg = ap_get_module_config(cmd->server->module_config, &status_module);
+  s_cfg->Handlername = (char *) arg;
+  return NULL;
+}
+
+/*
+ * creates the configuration records.
+ */
+static void *create_modstatus_config(apr_pool_t *p, server_rec *s)
+{
+        modstatus_config *newcfg;
+        // allocate space for the configuration structure from the provided pool p.
+        newcfg = (modstatus_config *) apr_pcalloc(p, sizeof(modstatus_config));
+        // set the default value for the status-handler-string.
+        newcfg->Handlername = "server-status";
+        // return the new server configuration structure.
+        return (void *) newcfg;
+}
+
 /*
  * command-related code. This is here to prevent use of ExtendedStatus
  * without status_module included.
@@ -142,6 +181,8 @@
 
 static const command_rec status_module_cmds[] =
 {
+    AP_INIT_TAKE1("ServerStatusHandlerName", set_serverstatus_handler_name, NULL, RSRC_CONF,
+      "\"String\" to define the Handler for Serverstatus-Handlername. Used to be \"server-status\""),
     AP_INIT_FLAG("ExtendedStatus", set_extended_status, NULL, RSRC_CONF,
       "\"On\" to enable extended status information, \"Off\" to disable"),
     AP_INIT_FLAG("SeeRequestTail", set_reqtail, NULL, RSRC_CONF,
@@ -248,8 +289,11 @@
     clock_t tu, ts, tcu, tcs;
     ap_generation_t worker_generation;
 
+    modstatus_config *s_cfg = ap_get_module_config(r->server->module_config, &status_module);
+
     if (strcmp(r->handler, STATUS_MAGIC_TYPE) &&
-        strcmp(r->handler, "server-status")) {
+        //strcmp(r->handler, "server-status-vs")) {
+        strcmp(r->handler, s_cfg->Handlername)) {
         return DECLINED;
     }
 
@@ -873,7 +917,7 @@
     STANDARD20_MODULE_STUFF,
     NULL,                       /* dir config creater */
     NULL,                       /* dir merger --- default is to override */
-    NULL,                       /* server config */
+    create_modstatus_config,    /* server config */
     NULL,                       /* merge server config */
     status_module_cmds,         /* command table */
     register_hooks              /* register_hooks */

Reply via email to