[hunchentoot-devel] Problem with late calls to POST-PARAMETERS

Peter Seibel peter at gigamonkeys.com
Mon Jun 1 21:21:26 UTC 2009


I ran into a problem converting some of my code to run with
Hunchentoot 1.0. This patch fixes it and -- as far as I can tell after
a bit of poking around -- is possibly righteous. What do you think?
The basic problem that I ran into is explained in the comment in the
patch.

-Peter

diff -r 635083ac9419 hunchentoot/request.lisp
--- a/hunchentoot/request.lisp	Sun May 31 11:31:25 2009 -0700
+++ b/hunchentoot/request.lisp	Mon Jun 01 14:19:19 2009 -0700
@@ -346,7 +346,12 @@
   (get-parameters request))

 (defmethod post-parameters :before ((request request))
-  (maybe-read-post-parameters :request request))
+  ;; Force here because if someone calls POST-PARAMETERS they actually
+  ;; want them, regardless of why the RAW-POST-DATA has been filled
+  ;; in. (For instance, if SEND-HEADERS has been called, filling in
+  ;; RAW-POST-DATA, and then subsequent code calls POST-PARAMETERS,
+  ;; without the :FORCE flag POST-PARAMETERS would return NIL.)
+  (maybe-read-post-parameters :request request :force t))

 (defun post-parameters* (&optional (request *request*))
   "Returns an alist of the POST parameters associated with the REQUEST


-- 
Peter Seibel
http://www.codersatwork.com/
http://www.gigamonkeys.com/blog/




More information about the Tbnl-devel mailing list