Re: [AOLSERVER] several questions - mostly C API
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 >
Re: [AOLSERVER] several questions - mostly C API
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 > > >
Re: [AOLSERVER] several questions - mostly C API
I wonder if the new, but still undocumented Ns_ConnSetLocationProc() can help you out: In AOLserver 3.2, it is in conn.c and look like this: >*-- > * Ns_SetConnLocationProc -- > * > * Set pointer to custom routine that acts like Ns_ConnLocation(); > * > * Results: > * None. > * > * Side effects: > * None. > * > *-- > */ >void >Ns_SetConnLocationProc(Ns_LocationProc *procPtr) >{ > locationPtr = procPtr; >} Jerry At 10:25 AM 6/17/01 +0300, you 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 > > = Jerry Asher [EMAIL PROTECTED] 1678 Shattuck Avenue Suite 161Tel: (510) 549-2980 Berkeley, CA 94709Fax: (877) 311-8688
[AOLSERVER] ANN: XSLT support in ns_xml available
I've added XSLT support to nsxml module. All information is available here: http://acs-misc.sourceforge.net/wiki/index.php?XsltSupportForAolserver I'll maintain nsxml module so if you have bugfixes, send them to me. Anyone in power here can give me CVS commit access to AOLServer@sourceforge (my user name is yond)? Or at least would one of those who have commit rights apply the patch? I can setup my own CVS but I would like to avoid nspostgres-like situation (people very confused about where to get nspostgres from).
Re: [AOLSERVER] sending ascii to a program listening on a port
On Wed, Jun 13, 2001 at 04:35:00PM -0700, Taber H. Smith wrote: > Hi, > > Is there any way to send a tcl string from within an AOLServer > tcl page to a unix program listening on a specified port on the > unix box? See the documentation for tho ns_sock* family of Tcl functions. http://www.aolserver.com/docs/tcldev/tcldev.htm -Roberto -- +| http://fslc.usu.edu USU Free Software & GNU/Linux Club |--+ Roberto Mello - Computer Science, USU - http://www.brasileiro.net http://www.sdl.usu.edu - Space Dynamics Lab, Developer * * * <- Tribbles<- Cloaked tribbles