From: Haris Bogdanovi� on 20 May 2010 14:11 I put mod_lisp.so file in apache/modules directory and have this in httpd.conf file: LoadModule lisp_module modules/mod_lisp.so LispServer 127.0.0.1 3000 "fractal" <Location /asp> SetHandler lisp-handler </Location> When I point my browser to http://localhost/asp/test.lisp (test.lisp only has (+ 1 2) just for test). I get an error from Apache: No connection could be made because the target machine actively refused it. error opening connection to Lisp I use emacs/clisp on windows What else I have to do to make this work ? Thanks
From: Rob Warnock on 20 May 2010 21:19 Haris Bogdanovi� <fbogdanovic(a)xnet.hr> wrote: +--------------- | LoadModule lisp_module modules/mod_lisp.so | LispServer 127.0.0.1 3000 "fractal" | <Location /asp> | SetHandler lisp-handler | </Location> | | ... http://localhost/asp/test.lisp ... I get an error from Apache: | No connection could be made because the target machine actively refused it. | error opening connection to Lisp +--------------- Did you start a server listening on localhost port 3000?!? That is, what happens if you type "telnet 127.0.0.1 3000" into a shell window? Do you get the same error? E.g.: $ telnet 127.0.0.1 3000 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host $ +--------------- | What else I have to do to make this work ? +--------------- Start a separate Lisp process listening on localhost port 3000 which is prepared to respond to the "mod_lisp" protocol. -Rob p.s. +--------------- | I use emacs/clisp on windows +--------------- You're probably going to have trouble getting CLISP to handle multiple requests from Apache at the same time. You'll probably want to switch to a Common Lisp with some sort of threading in it. ----- Rob Warnock <rpw3(a)rpw3.org> 627 26th Avenue <URL:http://rpw3.org/> San Mateo, CA 94403 (650)572-2607
From: Haris Bogdanovi� on 21 May 2010 11:41 > Start a separate Lisp process listening on localhost port 3000 > which is prepared to respond to the "mod_lisp" protocol. How do I start clisp or sbcl listening on some port ?
From: Haris Bogdanovi� on 21 May 2010 13:58 I started clisp process listening on port 3000 like socat exec:clisp tcp-listen:30000,reuseaddr I tried again: http://localhost/asp/test.lisp and apache responds (after waiting): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. : error reading from Lisp and in command line sockat exits with: socat[756] E write(5, 0x6f0cd0, 6): Software caused connection abort Where is the problem now ? I guess maybe I have to respond to clisp process somehow from my test.lisp ?
From: Rob Warnock on 21 May 2010 20:15
Haris Bogdanovi� <fbogdanovic(a)xnet.hr> wrote: +--------------- | I started clisp process listening on port 3000 like | socat exec:clisp tcp-listen:30000,reuseaddr | I tried again: | http://localhost/asp/test.lisp | and apache responds (after waiting): | A connection attempt failed because the connected party did not properly | respond after a period of time, or established connection failed because | connected host has failed to respond. : error reading from Lisp | | and in command line sockat exits with: | socat[756] E write(5, 0x6f0cd0, 6): Software caused connection abort | | Where is the problem now ? | I guess maybe I have to respond to clisp process somehow from my test.lisp ? +--------------- Exactly. You need to use the value returned from the LISTEN call to do an ACCEPT call[1] -- then possibly convert the file descriptor from ACCEPT into a CL STREAM object -- then read the request coming from Apache on that stream line at a time until you have read all of the the "mod_lisp" headers, then construct a proper HTTP response [based on the headers you have read] and write it to the stream.[2] Some example code for doing all of this can be found here: http://www.cliki.net/cl-modlisp though it looks like it doesn't work in CLISP (only AllegroCL, SBCL, LispWorks, and CMUCL are mentioned).[3] Still, it may give you some useful hints. -Rob [1] It sounds like you might benefit from a basic tutorial on socket- level network programming, see the section on "Implementation issues" at <http://en.wikipedia.org/wiki/Internet_socket>. The "External links" at the bottom also look like they might be helpful. [2] And at least in the beginning, I would CLOSE the stream after each reply. While "mod_lisp" does support persistent connections, it is much easier to debug if you don't use that feature at first. So be sure to include an HTTP "Connection: Close" header in your replies. [3] Again, as I noted before, a single-threaded CL such as CLISP is going to be *much* harder to interface to Apache+mod_lisp than a CL with *some* form of threading!! ----- Rob Warnock <rpw3(a)rpw3.org> 627 26th Avenue <URL:http://rpw3.org/> San Mateo, CA 94403 (650)572-2607 |