Index: request.lisp
===================================================================
--- request.lisp	(revision 4467)
+++ request.lisp	(working copy)
@@ -242,15 +242,17 @@
 EXTERNAL-FORMAT-OUT before they are sent to the server unless
 FORM-DATA is true in which case the POST request body is sent as
 `multipart/form-data' using EXTERNAL-FORMAT-OUT.  The values of the
-PARAMETERS alist can also be pathnames, open binary input streams,
-unary functions, or lists where the first element is of one of the
-former types.  These values denote files which should be sent as part
-of the request body.  If files are present in PARAMETERS, the content
-type of the request is always `multipart/form-data'.  If the value is
-a list, the part of the list behind the first element is treated as a
-plist which can be used to specify a content type and/or a filename
-for the file, i.e. such a value could look like, e.g.,
-\(#p\"/tmp/my_file.doc\" :content-type \"application/msword\"
+PARAMETERS alist can also be pathnames, lambda functions, open binary
+input streams, unary functions, or lists where the first element is of
+one of the former types.  These values denote lambda functions will
+got applied with nil parameter. These values denote files which should
+be sent as part of the request body.  If files are present in
+PARAMETERS, the content type of the request is always
+`multipart/form-data'.  If the value is a list, the part of the list
+behind the first element is treated as a plist which can be used to
+specify a content type and/or a filename for the file, i.e. such a
+value could look like, e.g., \(#p\"/tmp/my_file.doc\" :content-type
+\"application/msword\"
 :filename \"upload.doc\").
 
 CONTENT, if not NIL, is used as the request body - PARAMETERS is
@@ -543,7 +545,7 @@
                 (setq must-close close)
                 (write-header "Connection" "close"))
               (loop for (name . value) in additional-headers
-                    do (write-header name "~A" value))
+                    do (write-header name "~A" (if (functionp value) (apply value '()) value)))
               (when content
                 (when content-type
                   (write-header "Content-Type" "~A" content-type))
