Re: How to simple exit in CGI?
Pascal Bourguignon <[email protected]> Wed, 29 Mar 2017 00:32:11 +0200
| Newsgroups | gmane.lisp.clisp.general |
|---|---|
| Message-ID | <[email protected]> |
> On 29 Mar 2017, at 00:21, Jean Louis <[email protected]> wrote: > >>> (command (format nil "lisp -i ~a -x "(saveinitmem \"~a\" :executable t :init-function 'main :quiet t :norc t)"" original executable))) >> >> Here, you’re not using clisp, but CMU CL (lisp). >> (Each character is important, with computers). > > I don't know what you wish to say with that one. I am using CLISP at > all times. CMU CL does not compile on 64 bit architectures You have a typo, “lisp -i …” instead of “clisp -i …”. >> Your code is wrong. My code is correct: I proved it to you by >> showing you how it worked correctly in two different ways. > > I have tried those files you have sent to me. I did not notice they > were attached until I did. So I tried. I get again the problem, of > little different nature. You can see on this screenshot: > https://rcdrun.com/files/tmp/2017-03-29-01:16:51.jpg > > *** - OS-ERROR(EFAULT): Bad address > Break 1 [1]> You must have new code. >>> and if I make the same in CLISP: >>> >>> (defun main () >>> (exit)) >>> >>> and save as memory image, the wget is not exiting. Basically CLISP is >>> not exiting. >> >> You’re lying. > > Maybe you are joking. Anyway, I am not lying. I am trying to find out > why is it, so that I can avoid it. (exit) will exit. In (defun main () (exit)), there’s no code doing any I/O. > When you run that same jean-cgi script, as executable image and CGI on > your side, you don't get any error like me? Indeed, it works for me. For example: [pjb@despina :0.0]$ make clisp -q -ansi -norc -x '(load "generate-executable.lisp")' -x '(quit)' ;; Loading file generate-executable.lisp ... ;; Loading file /Users/pjb/quicklisp/setup.lisp ... ;; Loading file /Users/pjb/quicklisp/ASDF.lisp ... ;; Loaded file /Users/pjb/quicklisp/ASDF.lisp ;; Loaded file /Users/pjb/quicklisp/setup.lisp To load "jean-cgi": Load 1 ASDF system: jean-cgi ; Loading "jean-cgi" Bytes permanently allocated: 172,224 Bytes currently in use: 6,043,064 Bytes available until next GC: 1,509,636 ;; Loaded file generate-executable.lisp T ~/Sites/cgi/jean [pjb@despina :0.0]$ ./jean.cgi ~/Sites/cgi/jean [pjb@despina :0.0]$ curl --head 'http://localhost/~pjb/cgi/jean.cgi' HTTP/1.1 404 Not Found Date: Tue, 28 Mar 2017 22:29:47 GMT Server: Apache/2.2.32 (Unix) mod_ssl/2.2.32 OpenSSL/1.0.2k DAV/2 Content-Type: text/html; charset=iso-8859-1 ~/Sites/cgi/jean [pjb@despina :0.0]$ cat jean-cgi.lisp (in-package "JEAN-CGI") (defun main (&optional (arguments *args*)) (declare (ignore arguments)) (exit 0) (let ((url "http://localhost") (query (or (getenv "QUERY_STRING") (alexandria:read-stream-content-into-string *standard-input*)))) (format t "Status: 302 Found~%Location: ~a~%~%" url) (finish-output) (exit 0))) ~/Sites/cgi/jean [pjb@despina :0.0]$ The only difference as you can see, is that instead of getting a 302 status, we get a 404. This status is returned by apache that detects that the CGI didn’t do anything. -- __Pascal J. Bourguignon__ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ clisp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/clisp-list