I get an error while trying to handle form data which
comes with POST method, in portableAllegroServe 1.2.12c
on CMUCL 18d on FreeBSD 4.6.
The example code --which comes with portableAllegroServe--
also crashes while handling form.
What is wrong ?
Thanks for help.
HB
Error message is something like:
1-aserve-worker : 02/25/04 - 16:18:39 - while processing command "POST /tform
HTTP/1.1" got error #<Stream for descriptor 6> is not a character input stream.
Example code is:
;;
;; here's a form using the 'post' method
;;
(publish :path "/tform"
:content-type "text/html"
:function
(let ((name "unknown"))
#'(lambda (req ent)
(let ((body (get-request-body req)))
(format t "got body ~s~%" body)
(let ((gotname (assoc "username"
(form-urlencoded-to-query body)
:test #'equal)))
(if* gotname
then (setq name (cdr gotname)))))
(with-http-response (req ent)
(with-http-body (req ent)
(html (:head (:title "test form"))
(:body "Hello " (:princ-safe name) ", "
"Enter your name: "
((:form :action "/tform"
:method "post")
((:input :type "text"
:maxlength 10
:size 10
:name "username"))))))))))
Note :
There happens no error with GET method.