[Python-bugs-list] [ python-Bugs-792570 ] SimpleXMLRPCServer cannot
handle large requests
SourceForge.net
noreply at sourceforge.net
Thu Aug 21 09:37:32 EDT 2003
Bugs item #792570, was opened at 2003-08-21 11:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=792570&group_id=5470
Category: Python Library
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Marc-André Morissette (morissette)
Assigned to: Nobody/Anonymous (nobody)
Summary: SimpleXMLRPCServer cannot handle large requests
Initial Comment:
SimpleXMLRPCServer throws a WSAEINTR ioerror on
large XML-RPC requests.
Under Windows, the socket.read() method cannot seem
to handle large (tens of megabytes) reads (could be a
Python specific problem). This means that very large
XML-RPC requests can cause the exception.
Here is a tentative patch against 2.2.3 to fix the
problem. It should be easy to port it to 2.3
---
/cygdrive/c/Python22/Lib/SimpleXMLRPCServer.py
2003-07-09 14:16:52.000000000 -0400
+++ /cygdrive/z/SimpleXMLRPCServer.py 2003-08-21
11:01:19.000000000 -0400
@@ -73,6 +73,8 @@
import SocketServer
import BaseHTTPServer
import sys
+import cStringIO
class SimpleXMLRPCRequestHandler
(BaseHTTPServer.BaseHTTPRequestHandler):
"""Simple XML-RPC request handler class.
@@ -95,7 +97,14 @@
try:
# get arguments
- data = self.rfile.read(int(self.headers["content-
length"]))
+ max_chunk_size = 10000000
+ content_length = int(self.headers["content-
length"])
+ buffer = cStringIO.StringIO()
+ for offset in range(0, content_length,
max_chunk_size):
+ chunk_size = min(content_length - offset,
max_chunk_size)
+ buffer.write(self.rfile.read(chunk_size))
+ data = buffer.getvalue()
+ buffer.close()
params, method = xmlrpclib.loads(data)
# generate response
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=792570&group_id=5470
More information about the Python-bugs-list
mailing list