Jun 7, 2019, 3:49 PM by a...@software-lab.de: > Hi JmageK, > >> My question is how to have picolisp run the ana function whenever a request >> for a file or another html page arrives when it's running as a generic >> server. >> > > Usually I log only new sessions, by loading @lib/app.l in production > applications. This logs with 'msg' calls at the end of that file, the first > one > when the server is started, and then once for each new session. > I checked @lib/app.l it looks cool > If you want to log *every* access, you could do that by patching 'http', e.g. > with > I tried the patch it logs but gets some errors and fails to server any file
#This is f2.l file (load'@lib/http.l'@lib/xhtml.l) (de ana () (out "+log.txt" (prinl *Url " " (pack *Agent) " "*Referrer " "*Adr " " (time (time)))) ) (patch http '(out *HtSock (cond @X)) (fill '(prog (ana) (out *HtSock (cond @X)) ) ) ) (de main() (html 0 "title" "lib.css" "" (<h1> () "header 1") (ana) ) ) (server (format (opt)) "!main") #start server at port 8090 $ pil f2.l 8090 + #Visit localhost in a web browser localhost:8090 #I get no data sent error in browser and the connection stuck #on the server side the following one !? ((match '("-" @X "." "h" "t" "m" "l") U) (and *SesId (timeout *Timeout)) (apply try L 'html> (extern (ht:Pack @X T)))) NIL -- Undefined ? I'm unable to properly check which one is NIL--data gets corrupt on terminal when typing, I think it's html> > (patch http '(out *HtSock (cond @X)) > (fill > '(prog > (ana) > (out *HtSock (cond @X)) ) ) ) > The patch is a nice function. I'm having a hard time understanding this entire code. Can you explain how it works? What gets bound to @X? Thanks! JmageK -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe