newLISP Fan Club

Forum => Anything else we might add? => Topic started by: hilti on April 22, 2009, 09:30:06 AM

Title: HOW-TO serve multiple apps with the builtin newLISP -http
Post by: hilti on April 22, 2009, 09:30:06 AM
Hi Fan Club!



This is my day three on newLISP and my first post in this forums. Originally I came from PHP, took a short trip with Rails and discovered newLISP via a short research on the XEROX Star.



Yes - the XEROX Star - an old, but so impressive system which runs completely on LISP. I googled about LISP and found this forum. That's my story :-)



I'm very impressed about the work Lutz has done!!



Back to my topic:

Is it possible to serve multiple applications on Port 80 with the builtin newLISP webserver?



Maybe we could use the newLISP Wiki to build up some great HOW-TO tutorials.



What Do you think?



Best Regards from Germany!

Marc
Title:
Post by: cormullion on April 22, 2009, 02:31:20 PM
Hi Marc...


QuoteIs it possible to serve multiple applications on Port 80 with the builtin newLISP webserver?


If you can you access different CGI files underneath the specified directory, this might let you serve different applications...
Title:
Post by: cgs1019 on April 22, 2009, 05:29:33 PM
Marc



I am also new to newlisp. When I first found it I browsed the newlisp source and found that the http connection code is single threaded and blocks on more than one connection.



In order to use newlisp in a more robust server setting I'm playing with apache/cgi. Simply set up a webfolder, enable cgi in your apache server, and create an index.cgi script (with executable permissions) and you're in. Writing code to parse HTTP requests is an excellent exercise to familiarize yourself with newlisp :)



I use apache mod_rewrite to map arbitrary path requests through index.cgi and into handler code which enables me to model a RESTful(ish) sytle service. mod_rewrite should be present in any recent-ish apache dist, but might not be enabled by default in apache.conf (or httpd.conf, depending on dist), and there are lots of tutorials online. (Make sure you add AllowOverride to the Options statement in your apache configuration for the web directory in which you're using rewrite -- this has tripped me up a couple times and is tough to debug).



Anyway, I'm quite interested in the possibility of using newlisp's spawn, net-listen, net-accept, etc. to whip up a nice multi-threaded server with child threads spawning per connection and inheriting the parent symbol space. This would make for a very interesting and powerful dynamic system, customizable on the fly.



If you decide to try the apache stuff, feel free to post back here and I'll walk you through whatever you might have trouble with.



Cheers
Title:
Post by: cormullion on April 23, 2009, 08:28:44 AM
there are some threads that you guys might want to peruse:



http://www.alh.net/newlisp/phpbb/viewtopic.php?t=2464

http://www.alh.net/newlisp/phpbb/viewtopic.php?t=2203

http://www.alh.net/newlisp/phpbb/viewtopic.php?t=2197

http://www.alh.net/newlisp/phpbb/viewtopic.php?t=2191

http://www.alh.net/newlisp/phpbb/viewtopic.php?t=405

http://www.alh.net/newlisp/phpbb/viewtopic.php?t=434

http://www.alh.net/newlisp/phpbb/viewtopic.php?t=320
Title:
Post by: cgs1019 on April 23, 2009, 01:15:30 PM
This is great. Thanks a lot!