HOW-TO serve multiple apps with the builtin newLISP -http

For the Compleat Fan
Locked
hilti
Posts: 140
Joined: Sun Apr 19, 2009 10:09 pm
Location: Hannover, Germany
Contact:

HOW-TO serve multiple apps with the builtin newLISP -http

Post by hilti »

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

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Hi Marc...
Is 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...

cgs1019
Posts: 5
Joined: Wed Apr 08, 2009 8:12 pm
Location: Gainesville, FL
Contact:

Post by cgs1019 »

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
-- Christopher Suter

"The only reason for time is so that everything doesn't happen at once."
Albert Einstein


cgs1019
Posts: 5
Joined: Wed Apr 08, 2009 8:12 pm
Location: Gainesville, FL
Contact:

Post by cgs1019 »

This is great. Thanks a lot!
-- Christopher Suter

"The only reason for time is so that everything doesn't happen at once."
Albert Einstein

Locked