[Checkins] SVN: zope.app.http/trunk/ Respect the 'CONTENT_LENGTH' parameter to avoid a hanging read from a blocking socket.

Malthe Borch mborch at gmail.com
Thu Mar 12 08:32:09 EDT 2009


Log message for revision 97981:
  Respect the 'CONTENT_LENGTH' parameter to avoid a hanging read from a blocking socket.

Changed:
  U   zope.app.http/trunk/CHANGES.txt
  U   zope.app.http/trunk/src/zope/app/http/put.py

-=-
Modified: zope.app.http/trunk/CHANGES.txt
===================================================================
--- zope.app.http/trunk/CHANGES.txt	2009-03-12 12:27:49 UTC (rev 97980)
+++ zope.app.http/trunk/CHANGES.txt	2009-03-12 12:32:09 UTC (rev 97981)
@@ -5,7 +5,8 @@
 3.5.1 (unreleased)
 ------------------
 
-- ...
+- If the 'CONTENT_LENGTH' header is provided, provide this length as
+  argument to the ``read`` method of the input stream object.
 
 3.5.0 (2009-02-01)
 ------------------

Modified: zope.app.http/trunk/src/zope/app/http/put.py
===================================================================
--- zope.app.http/trunk/src/zope/app/http/put.py	2009-03-12 12:27:49 UTC (rev 97980)
+++ zope.app.http/trunk/src/zope/app/http/put.py	2009-03-12 12:32:09 UTC (rev 97981)
@@ -104,6 +104,8 @@
         body = self.request.bodyStream
         file = self.context
         adapter = IWriteFile(file)
-        adapter.write(body.read())
 
+        length = self.request.get('CONTENT_LENGTH', -1)
+        adapter.write(body.read(length))
+
         return ''



More information about the Checkins mailing list