Hi.
My nsmassvh module does not require any patches to the nsd core.
Here's how I get the hostname:
-- SNIP --
char *h;
h=NULL;
if ((c=Ns_TclGetConn(NULL))!=NULL)
{
if ((s=Ns_ConnHeaders(c))!=NULL)
h=Ns_SetIGet(s,"host");
}
-- SNIP --
I also remove the 'www.' from the beginning if it's there and remove the
':' character and any data following it (after doing a strncpy() to my
buffer :). And of course first check if h is set - it won't be set with
HTTP/0.9 request (a real oddity nowadays but should be considered :).
IMHO it's a better solution, works just as fast as w/o the module (about
1% loss on helloworld.html :)
For now it suits me fine, but I'll probably do something similar to your
nsvirtual, but based on other policies - mostly on subdomain matching as
well - ie user.silent.pl=/home/user/public_html and
sub.domain.tcl.pl=/var/www/tcl.pl/domain/sub.
Also, it should be based on priorities and XML in my case. But thanks for
the tip on using Ns_Set and async file reading :)
--
Wojtek Kocjan
[EMAIL PROTECTED]
On Sun, 17 Jun 2001, Boris Georgiev wrote:
> Well, I'm modifying return.c, because in the Ns_ConnReturnRedirect() it is
> used Ns_ConnLocation(), which has in its comments:
>
> * Ns_ConnLocation --
> *
> * Get the location of this connection. It is of the form
> * METHOD://HOSTNAME:PORT
>
> The problem was that it returns the hostname of the server, which is set in
> the config file and when I am requesting a virtual host, using our patch and
> request http://virtualhost.domain.com/somedir Aolserver redirects my request
> to http://host_of_the_server/somedir/ and not
> http://virtualhost.domain.com/somedir/
> Everything is for the slash here. That's why I had to patch it. I don't
> claim that there isn't any better way to fix this, but that's what we did.
> About the module that you check out, although I'm not a TCL guru, I don't
> know what will be the behaviour of this module if you have more than 15000
> virtualhosts and more than 20Mbps web traffic. I know that our module works
> fine in these conditions and thanks to the prefect code of Aolserver. I
> preffered to write it in C, because I don't have any experience with TCL.
>
> Best regards,
> Boris Georgiev
>
> ----- Original Message -----
> From: "Tom Jackson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, June 17, 2001 7:22 AM
> Subject: Re: [AOLSERVER] several questions - mostly C API
>
>
> > Boris Georgiev wrote:
> >
> > > http://www.ludost.net/nsvirtual
> >
> > Since redirects use ns_returnredirect, you could have avoided patching
> > return.c
> > For an example of how to do it look at:
> > http://zmbh.com/discussion/vat/vat.txt
> >
> > This module uses nsv arrays to store virtual server variables. Some
> > variables, like pageroot are set on server startup. Others are set per
> > connection. Any of these variables can be used to set the per connection
> > pageroot/templateroot. All variables are available for update without
> > restarting the server. It is easy to add new variables without patching
> > the module code.
> >
> > --Tom Jackson
> >
>