Re: How to simple exit in CGI?

Pascal Bourguignon <[email protected]> Tue, 28 Mar 2017 02:32:48 +0200
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
> On 27 Mar 2017, at 20:23, Jean Louis <[email protected]> wrote:
> 
> Previous message was not well formulated:
> 
> The "program" is here:
> 
> (defun main ()
>  (ext:exit 0))
> 
> is saved as memory image test.cgi
> 
> I would like to simply exit as CGI program. When I make the memory
> image, and run 
> http://localhost/test.cgi?a or if I put any char after cgi, like / or ?a=1 the memory image is exiting or giving its output
> 
> If I just call it with
> wget -O /dev/shm/test "http://localhost/order.cgi"
> 
> I get after longer waiting of about 45 seconds following output:
> 
> *** - Ctrl-C: User break
> Break 1 [1]> 
> 
> 
> How can I avoid that? It is for the security of the CGI execution, tht
> without parameters it should simply exit, but exiting seem a problem to me.

You should print out HTTP headers.  You can use them to report some status.

Something like:

#!/usr/local/bin/clisp -q -ansi -norc -E utf-8
;; -*- mode:lisp;coding:utf-8 -*-

(defun main ()
  (write-string "Content-Type: text/plain
Content-Length: 0
Status: 204


")
  (finish-output)
  (ext:exit 0))

(main)


-- 
__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