Re: How to simple exit in CGI?

Antoniotti Marco <[email protected]> Thu, 30 Mar 2017 18:36:25 +0000
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
Tip.

Lispers (well, at least one of them) abhor “main” :) :) :)

Cheers
—
MA






> On Mar 30, 2017, at 19:04 , Jean Louis <[email protected]> wrote:
> 
> Thank you for helping.
> 
> I found solution, as jasom on IRC, told me to check for
> *standard-input* by using listen.
> 
> So, now I can run the CGI without POST and without GET parameters, and
> without getting blocked, as Lisp is not waiting any more.
> 
> In the mean time I am learning ASDF.
> 
> Jean
> 
> (load "/home/data1/protected/lisp/quicklisp.lisp")
> (ql:quickload "alexandria")
> 
> (defun main (&optional (arguments *args*))
>  (if (listen *standard-input*)
>    (progn 
>      (headers)
>      (print "Standard input here"))
>    (progn
>      (headers)
>      (print "No standard input")))
> 
>  ;; (declare (ignore arguments))
>  ;; (unless (listen *standard-input*)
>  ;;   ;;              (getenv "QUERY_STRING"))
>  ;;   (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))
> 
> ------------------------------------------------------------------------------
> 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

--
Marco Antoniotti, Associate Professor		tel.	+39 - 02 64 48 79 01
DISCo, Università Milano Bicocca U14 2043		http://bimib.disco.unimib.it
Viale Sarca 336
I-20126 Milan (MI) ITALY

Please check: http://cdac2017.lakecomoschool.org
Please check: https://sites.google.com/site/troncopackage/

Please note that I am not checking my Spam-box anymore.
Please do not forward this email without asking me first (cum grano salis).





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