[bknr-cvs] edi changed trunk/thirdparty/drakma/

BKNR Commits bknr at bknr.net
Mon Feb 9 10:14:59 UTC 2009


Revision: 4196
Author: edi
URL: http://bknr.net/trac/changeset/4196

Be liberal about content length

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-02-09 10:08:05 UTC (rev 4195)
+++ trunk/thirdparty/drakma/CHANGELOG.txt	2009-02-09 10:14:59 UTC (rev 4196)
@@ -1,6 +1,7 @@
 Version 0.12.0
 2009-02-09
 Use the new ("binary") version of Chunga
+Be more lenient about content length (thanks to Zach Beane and "pix")
 Added conditions types
 Added *ALLOW-DOTLESS-COOKIE-DOMAINS-P* (thanks to Daniel Janus)
 Fix generation of user agent header (bug caught by Chaitanya Gupta)

Modified: trunk/thirdparty/drakma/doc/index.html
===================================================================
--- trunk/thirdparty/drakma/doc/index.html	2009-02-09 10:08:05 UTC (rev 4195)
+++ trunk/thirdparty/drakma/doc/index.html	2009-02-09 10:14:59 UTC (rev 4196)
@@ -881,13 +881,12 @@
 content body.  Note that this will not work with some older web
 servers.
 <p>
-<a class=none name="content-length2">A non-<code>NIL</code> <code><i>content-length</i></code> argument</a>
-means that Drakma <em>must</em> build the request body in RAM and
-compute the content length even if it would have otherwise used
-chunked encoding - for example in the case of file uploads.  A special
-case is the value <code>T</code>
-for <code><i>content-length</i></code> which means that Drakma should
-compute the content length after building the request body.
+<a class=none name="content-length2">Providing
+a</a> <a href="http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_t.htm#true">true</a>
+CONTENT-LENGTH argument which is not a non-negative integer means that
+Drakma <em>must</em> build the request body in RAM and compute the
+content length even if it would have otherwise used chunked encoding,
+for example in the case of file uploads.
 <p>
 <a class=none name="content-type"><code><i>content-type</i></code></a> is the
 corresponding 'Content-Type' header to be sent and will be ignored

Modified: trunk/thirdparty/drakma/request.lisp
===================================================================
--- trunk/thirdparty/drakma/request.lisp	2009-02-09 10:08:05 UTC (rev 4195)
+++ trunk/thirdparty/drakma/request.lisp	2009-02-09 10:14:59 UTC (rev 4196)
@@ -285,12 +285,10 @@
 send the content body.  Note that this will not work with older web
 servers.
 
-A non-NIL CONTENT-LENGTH argument means that Drakma /must/ build the
-request body in RAM and compute the content length even if it would
-have otherwise used chunked encoding, for example in the case of file
-uploads.  A special case is the value T for CONTENT-LENGTH which means
-that Drakma should compute the content length after building the
-request body.
+Providing a true CONTENT-LENGTH argument which is not a non-negative
+integer means that Drakma /must/ build the request body in RAM and
+compute the content length even if it would have otherwise used
+chunked encoding, for example in the case of file uploads.
 
 CONTENT-TYPE is the corresponding `Content-Type' header to be sent and
 will be ignored unless CONTENT is provided as well.
@@ -398,8 +396,6 @@
     (parameter-error "Don't know how to handle scheme ~S." (uri-scheme uri)))
   (when (and close keep-alive)
     (parameter-error "CLOSE and KEEP-ALIVE must not be both true."))
-  (when (and (eq content :continuation) content-length)
-    (parameter-error "CONTENT-LENGTH must be NIL if CONTENT is :CONTINUATION."))
   (when (and form-data (not (eq method :post)))
     (parameter-error "FORM-DATA makes only sense with POST requests."))
   ;; convert PROXY argument to canonical form
@@ -550,7 +546,9 @@
                 (when content-type
                   (write-header "Content-Type" "~A" content-type))
                 (when (and content-length
-                           (not (or (arrayp content)
+                           (not (or (and (integerp content-length)
+                                         (not (minusp content-length)))
+                                    (arrayp content)
                                     (listp content)
                                     (eq content :continuation))))
                   ;; CONTENT-LENGTH forces us to compute request body





More information about the Bknr-cvs mailing list