[Mono-devel-list] [PATCH] Virtual hosts with mod_mono_server

Jaroslaw Kowalski jaak at zd.com.pl
Thu Feb 5 18:00:02 EST 2004

Answering to myself: I've made some research and looks like virtual hosts
can be implemented entirely on the "mod_mono_server" level. I've attached a
patch that does this.

Basically it extends the application specification so that you can include
your vhost parameters.


I've completely rewritten "GetApplicationForPath()" method:

1. I've replaced the hashtable lookup with a linear scan of an array (in
most cases you have only a small number of applications and the performance
of hashtable is poor in this case). For larger installations (e.g. hosting
providers) it may be useful to do something more advanced (hashing or binary
search) so that the method scales better, but I'm not sure if it's worth it.

2. I've eliminated all allocations from this method (there were actually a
lot of them in String.Join() and String.Split()). Instead of splitting and
re-joining strings I'm simply looking for an entry with the longest matching
prefix. This is easily done with StartsWith() which afaik doesn't allocate

3. My patch allows two "vpaths" to point to a single physical directory and
run two different applicationhosts there.

4. There are some TODOs - basically related to retrieving information from
the HTTP headers (port and host) but I don't have time and knowledge to dig
into it as it looks to be apache-dependent.

Can someone verify the patch, fix the TODOs and commit if it's ok? I've got
only anoncvs access and this patch was made against today's fresh copy.


----- Original Message ----- 
From: "Jaroslaw Kowalski" <jaak at zd.com.pl>
To: "mono-devel mailing list" <mono-devel-list at lists.ximian.com>
Sent: Thursday, February 05, 2004 10:01 PM
Subject: [Mono-devel-list] Virtual hosts with mod_mono_server

> Is it possible to run multiple ASP.NET applications with mod_mono when
> apache is configured for name-based virtual hosts? The applications are to
> be located the vhost root.
> http://sitea.net/index.aspx
> http://siteb.net/index.aspx
> Do I need multiple mod_mono_server.exe's?
> Jarek
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vhosts.patch
Type: application/octet-stream
Size: 8180 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040206/3dbbfb79/attachment.obj 

More information about the Mono-devel-list mailing list