Hi Alex,

I am trying to achieve http://twisted.ecritters.biz/replacedemo (works
in Mozilla based browsers only apparently) in picolisp.  Something
like the following works except when a client closes the connection,
the server process serving it crashes with sig-11.

(load "@ext.l" "@lib/http.l" "@lib/xhtml.l")

(de start ()
   (prinl "HTTP/1.1 200 OK^M")
   (prin "Date:") (httpDate (date T) (time T))
   (prinl "Content-Type: multipart/x-mixed-replace; boundary=hicuriousperson^M")
   (prinl "^M")
      (prinl "Content-Type: text/plain^M")
      (prinl "^M")
      (prinl "The time is:")
      (prinl "+--------+")
      (prinl "|" (tim$ (time) T) "|")
      (prinl "+--------+")
      (prinl "--hicuriousperson^M")
      (wait 1000)))

(server 8090 "@start")

The crash is at 0x080694ce in putStdout (c=67) at io.c:2132.

I am wondering whether there is a way to end the loop without
crashing?  I tried (loop ... (NIL (flush))) but that does not work and
cannot find any other function that could give me some value
indicating the socket has been closed and the loop should stop.

Why does it work normally if the server serves some big file which
takes time and the client closes the connection in the middle of it?

Thank you,


Reply via email to