[bknr-cvs] edi changed trunk/thirdparty/drakma/
BKNR Commits
bknr at bknr.net
Tue Dec 1 22:36:55 UTC 2009
Revision: 4480
Author: edi
URL: http://bknr.net/trac/changeset/4480
Allow additional headers to be functions
U trunk/thirdparty/drakma/CHANGELOG.txt
U trunk/thirdparty/drakma/doc/index.html
U trunk/thirdparty/drakma/request.lisp
Modified: trunk/thirdparty/drakma/CHANGELOG.txt
===================================================================
--- trunk/thirdparty/drakma/CHANGELOG.txt 2009-12-01 22:06:56 UTC (rev 4479)
+++ trunk/thirdparty/drakma/CHANGELOG.txt 2009-12-01 22:36:55 UTC (rev 4480)
@@ -1,3 +1,4 @@
+Allowed additional headers to be function designators (suggested by Xiangjun Wu)
Be more liberal when parsing cookies (thanks to Andrei Stebakov)
Added HTTP method PATCH (thanks to Xiangjun Wu)
Don't send GET parameters again when redirecting (reported by Eugene Ossintsev)
Modified: trunk/thirdparty/drakma/doc/index.html
===================================================================
--- trunk/thirdparty/drakma/doc/index.html 2009-12-01 22:06:56 UTC (rev 4479)
+++ trunk/thirdparty/drakma/doc/index.html 2009-12-01 22:36:55 UTC (rev 4480)
@@ -935,11 +935,15 @@
<a class=none name="proxy-basic-authorization"><code><i>proxy-basic-authorization</i></code></a> is used like <code><i>basic-authorization</i></code>, but for
the proxy, and only if <code><i>proxy</i></code> is true.
<p>
-<a class=none name="additional-headers"><code><i>additional-headers</i></code></a> is a
-name/value <a
-href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_a.htm#alist">alist</a>
-(like <code><i>parameters</i></code>) of additional HTTP headers which
-should be sent with the request.
+<a class=none
+name="additional-headers"><code><i>additional-headers</i></code></a>
+is a
+name/value <a href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_a.htm#alist">alist</a>
+of additional HTTP headers which should be sent with the request.
+Unlike in <code><i>parameters</i></code>, the cdrs can not only be
+strings but also designators for unary functions (which should in turn
+return a string) in which case the function is called each time the
+header is written.
<p>
If <a name="redirect" class=none><code><i>redirect</i></code></a> is
not <code>NIL</code>, it must be a non-negative integer
Modified: trunk/thirdparty/drakma/request.lisp
===================================================================
--- trunk/thirdparty/drakma/request.lisp 2009-12-01 22:06:56 UTC (rev 4479)
+++ trunk/thirdparty/drakma/request.lisp 2009-12-01 22:36:55 UTC (rev 4480)
@@ -321,8 +321,11 @@
BASIC-AUTHORIZATION, but for the proxy, and only if PROXY is
true.
-ADDITIONAL-HEADERS is a name/value alist \(like PARAMETERS) of
-additional HTTP headers which should be sent with the request.
+ADDITIONAL-HEADERS is a name/value alist of additional HTTP headers
+which should be sent with the request. Unlike in PARAMETERS, the cdrs
+can not only be strings but also designators for unary functions
+\(which should in turn return a string) in which case the function is
+called each time the header is written.
If REDIRECT is not NIL, it must be a non-negative integer or T.
If REDIRECT is true, Drakma will follow redirects \(return codes
@@ -543,7 +546,10 @@
(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"
+ (cond ((or (functionp value) (symbolp value))
+ (funcall value))
+ (t value))))
(when content
(when content-type
(write-header "Content-Type" "~A" content-type))
More information about the Bknr-cvs
mailing list