httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Finch <...@dotat.at>
Subject Re: [PATCH] vhost hostname in scoreboard not useful when using mod_vhost_alias
Date Wed, 05 Jan 2000 13:53:56 GMT
Tony Finch <dot@dotat.at> wrote:
>"Cliff Woolley" <jwoolley@wlu.edu> wrote:
>>
>>   I noticed a little problem today with the way the scoreboard in
>>1.3.9 stores the vhost information for display in mod_status when using
>>mod_vhost_alias.  The vhost's hostname is the only one stored, not the
>>request hostname, which is what we really want to see out of mod_status.
>
>Sometimes :-) (see the UseCanonicalName DNS option)
>
>The real fix here would be to have mod_status use ap_get_server_name
>so that it reflects how the server has been configured. This requires
>adding a reference to the request_req to the scoreboard (perhaps
>instead of the server_req).

And if you would like a patch, this compiles but I haven't tested it.
This avoids the string-copying that the previous patch did.

Tony.
-- 
I'm the dot in dot at

--- src/include/ap_mmn.h.old	Sat Aug 14 09:53:48 1999
+++ src/include/ap_mmn.h.2000-01-05	Wed Jan  5 13:10:07 2000
@@ -226,14 +226,16 @@
  *                        ap_base64encode_len(), ap_base64decode(),
  *                        ap_base64decode_binary(), ap_base64decode_len(),
  *                        ap_pbase64decode(), ap_pbase64encode()
+ * 	    (1.3.10-dev)
+ * 20000105		- replace vhostrec in the scoreboard with req
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 19990320
+#define MODULE_MAGIC_NUMBER_MAJOR 20000105
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 6                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 0                     /* 0...n */
 #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR	/* backward compat */
 
 /* Useful for testing for features. */
--- src/include/scoreboard.h.old	Thu Oct 21 21:44:23 1999
+++ src/include/scoreboard.h.2000-01-05	Wed Jan  5 13:29:47 2000
@@ -111,20 +111,20 @@
  * new generation of children to be spawned.  Children within the same
  * generation share the same configuration information -- pointers to stuff
  * created at config time in the parent are valid across children.  For
- * example, the vhostrec pointer in the scoreboard below is valid in all
+ * example, the req pointer in the scoreboard below is valid in all
  * children of the same generation.
  *
- * The safe way to access the vhost pointer is like this:
+ * The safe way to access the req pointer is like this:
  *
  * short_score *ss = pointer to whichver slot is interesting;
  * parent_score *ps = pointer to whichver slot is interesting;
- * server_rec *vh = ss->vhostrec;
+ * request_rec *vh = ss->req;
  *
  * if (ps->generation != ap_my_generation) {
- *     vh = NULL;
+ *     req = NULL;
  * }
  *
- * then if vh is not NULL it's valid in this child.
+ * then if req is not NULL it's valid in this child.
  *
  * This avoids various race conditions around restarts.
  */
@@ -158,7 +158,7 @@
 #endif
     char client[32];		/* Keep 'em small... */
     char request[64];		/* We just want an idea... */
-    server_rec *vhostrec;	/* What virtual host is being accessed? */
+    request_rec *req;		/* to find which vhost is being accessed */
                                 /* SEE ABOVE FOR SAFE USAGE! */
 } short_score;
 
--- src/main/http_main.c.old	Wed Jan  5 13:03:46 2000
+++ src/main/http_main.c.2000-01-05	Wed Jan  5 13:10:35 2000
@@ -2255,14 +2255,14 @@
 					       r->assbackwards ? NULL : " ", r->protocol, NULL),
 				       sizeof(ss->request));
 	    }
-	    ss->vhostrec =  r->server;
+	    ss->req = r;
 	}
     }
     if (status == SERVER_STARTING && r == NULL) {
-	/* clean up the slot's vhostrec pointer (maybe re-used)
+	/* clean up the slot's req pointer (maybe re-used)
 	 * and mark the slot as belonging to a new generation.
 	 */
-	ss->vhostrec = NULL;
+	ss->req = NULL;
 	ap_scoreboard_image->parent[child_num].generation = ap_my_generation;
 #ifdef SCOREBOARD_FILE
 	lseek(scoreboard_fd, XtOffsetOf(scoreboard, parent[child_num]), 0);
--- src/modules/standard/mod_status.c.old	Wed Jan  5 13:34:47 2000
+++ src/modules/standard/mod_status.c.2000-01-05	Wed Jan  5 13:39:26 2000
@@ -254,7 +254,7 @@
     char stat_buffer[HARD_SERVER_LIMIT];
     int pid_buffer[HARD_SERVER_LIMIT];
     clock_t tu, ts, tcu, tcs;
-    server_rec *vhost;
+    request_rec *req;
 
     tu = ts = tcu = tcs = 0;
 
@@ -491,9 +491,9 @@
 	for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
 	    score_record = ap_scoreboard_image->servers[i];
 	    ps_record = ap_scoreboard_image->parent[i];
-	    vhost = score_record.vhostrec;
+	    req = score_record.req;
 	    if (ps_record.generation != ap_my_generation) {
-		vhost = NULL;
+		req = NULL;
 	    }
 
 #if defined(NO_GETTIMEOFDAY)
@@ -599,7 +599,7 @@
 			ap_rprintf(r, " <i>%s {%s}</i> <b>[%s]</b><br>\n\n",
 			    score_record.client,
 			    ap_escape_html(r->pool, score_record.request),
-			    vhost ? vhost->server_hostname : "(unavailable)");
+			    req ? ap_get_server_name(req) : "(unavailable)");
 		    }
 		    else {		/* !no_table_report */
 			if (score_record.status == SERVER_DEAD)
@@ -672,7 +672,7 @@
 			    ap_rprintf(r,
 			     "<td>%s<td nowrap>%s<td nowrap>%s</tr>\n\n",
 			     score_record.client,
-			     vhost ? vhost->server_hostname : "(unavailable)",
+			     req ? ap_get_server_name(req) : "(unavailable)",
 			     ap_escape_html(r->pool, score_record.request));
 		    }		/* no_table_report */
 		}			/* !short_report */

Mime
View raw message