newLisp as web server

Started by ale870, July 31, 2009, 11:18:45 AM

Previous topic - Next topic

ale870

Hello,



sorry but I have another question about newLisp as web server (using -http flag).

Well, I'm working with (command-event) function (and it works as expected), but I cannot get POST data. I tried to insert the code shown in the manual -using (device) and (read-buffer) - but it seems it does not work.

How can I get POST information from (command-event)? Is it possible? Else? How can I use post data without creating a real CGI?



Thank you again for your support!
--

Lutz

#1
'command-event' only reports the request line. The 'device/read-bufffer' method works only in CGI files, where std I/O pipes are used to communicate between the server and CGI process. You could retrieve the POST info using net-xxx functions. But then you abandon normal server processing and have to handle everything yourself, including sending back response headers, etc..



At that point it is most likely easier and shorter to write your own server in newLISP using the 'net-xxx' functions and implementing your own protocol.



It is easier to check POST variables inside the CGI pogramm. Use 'command-event' only to do URL rewriting and the like. The cgi.lsp module can handle retrieving POST data for you.

ale870

#2
Thank you!

I already used newLisp cgi and Apache web server (even with lighttpd server).

Since I need to implement something like net-eval, but with more control, do you suggest me to use (command-event) just to check if the request does not come from an "impostor", then using a standard cgi to process the request (or returning a generic web page error).



Thank you.
--