Chris van Wyk wrote:
> I am running a FC4 server relying on mod_mono AutoConfiguration.
> Unfortunately this died on me today.
> 
> I am running ver 1.1.18.0 and will appreciate it if someone could give me a
> hint on where to start looking for the problem.

Having now taken a look at what's happening, I apologize for breaking
things.

Anyway, I'm attaching a patch that seems like it fixes the problem.  The
problem was twofold.  First, virtual hosts seem to not all create a
XXGLOBAL (i.e. auto-configuration) mod-mono-server.  On my box, I have
XXGLOBAls for all of the virtual hosts in which I've explicitly
configured the 'default' entry (where I don't use auto configuration,
but the configuration gets applied to the XXGLOBAL entry) but not in the
virtual hosts that have no explicit AddMonoApplication directives.  I
don't understand why, but so it is.

Second (and this is what changed with my previous patch), now that each
mod-mono-server configuration entry knows which virtual host it was
created by and meant for, requests for pages on one virtual host would
not get handled by mod-mono-servers configured by a different virtual
host.  What was happening before was that virtual hosts with no mono
configuration lines would not have their own XXGLOBAL server created,
and so they would pick up the one created for the main server
configuration.  My change prevented that.

The attached patch makes the following change:

When looking for a mod-mono-server configuration for a particular alias
except the default alias, if such an alias wasn't configured in a vhost,
it will fall back to one configured in the main server configuration.

The effect for the breakage is if you don't do any mod_mono configuring
in a vhost, pages will be served by the XXGLOBAL for the main server
configuration if auto-configuration is enabled.  This is how things were
in 1.1.17.

I expected the patch to allow other aliases besides XXGLOBAL to fall
back, but I couldn't get it to do it...

-- 
- Joshua Tauberer

http://razor.occams.info

"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah."  -- The Colbert Report
Index: src/mod_mono.c
===================================================================
--- src/mod_mono.c	(revision 66828)
+++ src/mod_mono.c	(working copy)
@@ -95,12 +95,13 @@
 search_for_alias (const char *alias, module_cfg *config, server_rec *server)
 {
 	/* 'alias' may be NULL to search for the default XSP */
+	/* 'server' may be NULL to search in the main host */
 	int i;
 	xsp_data *xsp;
 
 	DEBUG_PRINT (2, "searching for alias '%s' in server '%s'",
 		alias == NULL ? "<default alias>" : alias,
-		!server->is_virtual || server->server_hostname == NULL ? "<main server>" : server->server_hostname);
+		server == NULL || !server->is_virtual || server->server_hostname == NULL ? "<main server>" : server->server_hostname);
 
 	for (i = 0; i < config->nservers; i++) {
 		xsp = &config->servers [i];
@@ -109,7 +110,7 @@
 			xsp->alias == NULL ? "<default alias>" : xsp->alias,
 			xsp->vhost == NULL ? "<main server>" : xsp->vhost);
 
-		if (!server->is_virtual || server->server_hostname == NULL) {
+		if (server == NULL || !server->is_virtual || server->server_hostname == NULL) {
 			if (xsp->vhost != NULL) continue;
 		} else {
 			if (xsp->vhost == NULL) continue;
@@ -123,6 +124,12 @@
 			return i;
 	}
 
+	// If we're not searching for the default alias, and
+	// we're searching in a vhost but didn't find a match,
+	// then search in the main server.
+	if (alias != NULL && server != NULL && server->is_virtual && server->server_hostname != NULL)
+		return search_for_alias(alias, config, NULL);
+
 	return -1;
 }
 
@@ -1443,6 +1450,11 @@
 
 		if (idx == -1) {
 			DEBUG_PRINT (2, "Global config not found. Finishing request.");
+			ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
+				"mod_mono was invoked to handle a request for %s with mod-mono-server alias %s but no mod-mono-server is registered to handle such a request",
+				r->server->is_virtual && r->server->server_hostname != NULL ? r->server->server_hostname : "<default host>",
+				alias == NULL ? "<default>" : alias
+				);
 			return HTTP_INTERNAL_SERVER_ERROR;
 		}
 	}

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 66828)
+++ ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2006-10-20 Joshua Tauberer <[EMAIL PROTECTED]>
+
+	* src/mod_mono.c: I broke AutoConfiguration in vhosts last time (doh).
+	  If there's no XXGLOBAL (or some other non-default alias)
+	  configured in the virtual host, then use one configured in the
+	  main server config.  (Why doesn't each virtual host get one
+	  created?)
+
 2006-10-19 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
 	* src/mod_mono.c: Modified file.
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to