]> granicus.if.org Git - python/commitdiff
The SimpleXMLRPCServer's CGI handler now runs like a pony.
authorGeorg Brandl <georg@python.org>
Wed, 1 Apr 2009 04:21:14 +0000 (04:21 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 1 Apr 2009 04:21:14 +0000 (04:21 +0000)
Lib/SimpleXMLRPCServer.py
Misc/NEWS

index 43757a03ddaf259e96bd9b8e8d2f59cf8f845a9c..4c286884a3f1303fa9e2c86f0802d43731734644 100644 (file)
@@ -598,8 +598,12 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
             self.handle_get()
         else:
             # POST data is normally available through stdin
+            try:
+                length = int(os.environ.get('CONTENT_LENGTH', None))
+            except ValueError:
+                length = -1
             if request_text is None:
-                request_text = sys.stdin.read()
+                request_text = sys.stdin.read(length)
 
             self.handle_xmlrpc(request_text)
 
index d51a3601d2b8e92438433a4e868ee8713f7ae94f..1d210a1cd7b46520c6f7ba3eaf47c4b0c27a78da 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -200,6 +200,8 @@ Core and Builtins
 Library
 -------
 
+- Actually make the SimpleXMLRPCServer CGI handler work.
+
 - Issue #2522: locale.format now checks its first argument to ensure it has
   been passed only one pattern, avoiding mysterious errors where it appeared
   that it was failing to do localization.