[bknr-cvs] hans changed trunk/thirdparty/hunchentoot/
BKNR Commits
bknr at bknr.net
Tue Apr 7 10:56:59 UTC 2009
Revision: 4364
Author: hans
URL: http://bknr.net/trac/changeset/4364
Add WITHIN-REQUEST-P function that can be used to check whether a request is processed within the current dynamic context. Provided by Mark David, ITA
U trunk/thirdparty/hunchentoot/doc/index.xml
U trunk/thirdparty/hunchentoot/packages.lisp
U trunk/thirdparty/hunchentoot/request.lisp
U trunk/thirdparty/hunchentoot/specials.lisp
Modified: trunk/thirdparty/hunchentoot/doc/index.xml
===================================================================
--- trunk/thirdparty/hunchentoot/doc/index.xml 2009-04-07 07:22:30 UTC (rev 4363)
+++ trunk/thirdparty/hunchentoot/doc/index.xml 2009-04-07 10:56:59 UTC (rev 4364)
@@ -2854,6 +2854,15 @@
</clix:function>
<clix:special-variable name="*tmp-directory*">
+ <clix:function name='within-request-p'>
+ <clix:lambda-list>
+ </clix:lambda-list>
+ <clix:returns>generalized-boolean
+ </clix:returns>
+ <clix:description>Returns true if in the context of a request. Otherwise, <code>NIL</code>.
+ </clix:description>
+ </clix:function>
+
<clix:description>
This should be a pathname denoting a directory where temporary
files can be stored. It is used for <a href="#upload">file
Modified: trunk/thirdparty/hunchentoot/packages.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/packages.lisp 2009-04-07 07:22:30 UTC (rev 4363)
+++ trunk/thirdparty/hunchentoot/packages.lisp 2009-04-07 10:56:59 UTC (rev 4364)
@@ -64,6 +64,7 @@
"*METHODS-FOR-POST-PARAMETERS*"
"*REPLY*"
"*REQUEST*"
+ "WITHIN-REQUEST-P"
"*REWRITE-FOR-SESSION-URLS*"
"*SESSION*"
"*SESSION-GC-FREQUENCY*"
Modified: trunk/thirdparty/hunchentoot/request.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/request.lisp 2009-04-07 07:22:30 UTC (rev 4363)
+++ trunk/thirdparty/hunchentoot/request.lisp 2009-04-07 10:56:59 UTC (rev 4364)
@@ -217,7 +217,8 @@
(let (*tmp-files* *headers-sent*)
(unwind-protect
(with-mapped-conditions ()
- (let* ((*request* request))
+ (let* ((*request* request)
+ (*within-request-p* t))
(multiple-value-bind (body error)
(catch 'handler-done
(handler-bind ((error
@@ -255,6 +256,10 @@
(ignore-errors
(delete-file path)))))))
+(defun within-request-p ()
+ "True if we're in the context of a request, otherwise nil."
+ *within-request-p*)
+
(defun parse-multipart-form-data (request external-format)
"Parse the REQUEST body as multipart/form-data, assuming that its
content type has already been verified. Returns the form data as
Modified: trunk/thirdparty/hunchentoot/specials.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/specials.lisp 2009-04-07 07:22:30 UTC (rev 4363)
+++ trunk/thirdparty/hunchentoot/specials.lisp 2009-04-07 10:56:59 UTC (rev 4364)
@@ -234,6 +234,11 @@
(defvar-unbound *request*
"The current REQUEST object while in the context of a request.")
+(defvar *within-request-p* nil
+ "True while in the context of a request (while *request* is bound),
+otherwise nil. Outside callers should use exported function
+within-request-p to test this.")
+
(defvar-unbound *reply*
"The current REPLY object while in the context of a request.")
More information about the Bknr-cvs
mailing list