Sophie

Sophie

distrib > Mandriva > 2011.0 > i586 > media > main-updates-src > by-pkgid > 70c6f73b7de273a264c9a8c049dad72b > files > 5

python-2.7.2-2.2.src.rpm

diff -Naurp Python-2.7.2/Lib/SimpleXMLRPCServer.py Python-2.7.2.oden/Lib/SimpleXMLRPCServer.py
--- Python-2.7.2/Lib/SimpleXMLRPCServer.py	2011-06-11 15:46:23.000000000 +0000
+++ Python-2.7.2.oden/Lib/SimpleXMLRPCServer.py	2012-06-19 11:40:10.000000000 +0000
@@ -486,7 +486,10 @@ class SimpleXMLRPCRequestHandler(BaseHTT
             L = []
             while size_remaining:
                 chunk_size = min(size_remaining, max_chunk_size)
-                L.append(self.rfile.read(chunk_size))
+                chunk = self.rfile.read(chunk_size)
+                if not chunk:
+                    break
+                L.append(chunk)
                 size_remaining -= len(L[-1])
             data = ''.join(L)
 
diff -Naurp Python-2.7.2/Lib/test/test_xmlrpc.py Python-2.7.2.oden/Lib/test/test_xmlrpc.py
--- Python-2.7.2/Lib/test/test_xmlrpc.py	2011-06-11 15:46:26.000000000 +0000
+++ Python-2.7.2.oden/Lib/test/test_xmlrpc.py	2012-06-19 11:40:10.000000000 +0000
@@ -586,6 +586,12 @@ class SimpleServerTestCase(BaseServerTes
         # This avoids waiting for the socket timeout.
         self.test_simple1()
 
+    def test_partial_post(self):
+        # Check that a partial POST doesn't make the server loop: issue #14001.
+        conn = httplib.HTTPConnection(ADDR, PORT)
+        conn.request('POST', '/RPC2 HTTP/1.0\r\nContent-Length: 100\r\n\r\nbye')
+        conn.close()
+
 class MultiPathServerTestCase(BaseServerTestCase):
     threadFunc = staticmethod(http_multi_server)
     request_count = 2