cgi.lsp processes POST parameters using read-line:
Code: Select all
; get stdin POST method parameters if present
;
(set 'inline (read-line))
(if inline
(set 'params (get-vars inline)))
(if (not params) (set 'params '()))
Code: Select all
; get stdin POST method parameters if present
;
(when (= (env "HTTP_METHOD") "POST")
(read (device) post-data (integer (env "CONTENT_LENGTH")))
(set 'params (get-vars post-data)))
(if (not params) (set 'params '()))
Thanks.
EDIT: After I submitted the post, I went through the nl-web.c and it seems to me that my changes will not work with newLISP's built in web server's CGI handler, as it does not set the CONTENT_LENGTH variable. Actually it only sets a subset of variables, at least compared to what CGI/1.1 spec says. It might be worth mentioning in the docs that CGI environment variables apart from the mentioned HTTP_HOST, HTTP_USER_AGENT and HTTP_COOKIE (and some other) are not being set.