newLISP Fan Club

Forum => newLISP in the real world => Topic started by: TedWalther on June 09, 2010, 01:24:05 PM

Title: webserver multiple domains
Post by: TedWalther on June 09, 2010, 01:24:05 PM
Has anyone else used the newlisp http mode to host several domains at once?  Is the appropriate method to modify the command-prompt?  Is an environment variable already set, or should I parse stdin to find out what the domain is?  How much parsing does newlisp do in http mode?  Just the first line of PUT/GET/etc?  And what variables does newlisp use to do its evaluating/processing afterward.



For instance, I want to hook in a handler to generate a directory listing.  Is there a callback I can set?  Or should I just "exit" once I'm done handling my URL, on the assumption that newlisp forks for every connection?  What if I want to futz with the headers a bit, but otherwise let newlisp do its thing of reading a file and blasting it out over the socket?  Should I do that in newlisp?  Do I lose much efficiency in read/write by doing that?



I host quite a few domains; I'm currently migrating them all over to the newlisp webserver.



I understand about setting the Status line, then having complete control over the output.  Guess I'll have to make utility functions to do things that newlisp does automatically under the hood.



Ted
Title: Re: webserver multiple domains
Post by: Lutz on June 09, 2010, 04:01:32 PM
newLISP server doesn't fork connections, but you can run it using the Unix inetd utility, and then a new instance gets launched on every connection. As newLISP has a quick load time the overhead of launching can be neglected. You can read all about this in the Users Manual.



For redirection and rewriting urls and requests use 'command-event' in a http-conf.lsp as also described in the Users Manual and also described in Code Patterns.



To see environment variables set by newLISP you can run:

http://www.newlisp.org/syntax.cgi?environment.txt



  
Title: Re: webserver multiple domains
Post by: itistoday on June 09, 2010, 08:06:13 PM
I don't think newLISP's built-in web server is designed to be used to host live websites.... Doesn't sound like a very good idea. :-
Title: Re: webserver multiple domains
Post by: TedWalther on June 09, 2010, 10:43:09 PM
I did read the Code Patterns article; that is what prompted me to try the experiment in the first place.  I see it would take more work than I have time for at the moment; I'm dropping back to having newLISP generate my Apache config.