[Medusa-dev]
[Medusa bug and patch] XML-RPC replies silently truncated to 1024
characters
Andrew Kuchling
akuchlin@mems-exchange.org
Wed, 18 Sep 2002 15:25:29 -0400
On Tue, Sep 17, 2002 at 11:35:32AM +0200, Stephane Bortzmeyer wrote:
>Here is a patch which works for me. The bug is in http_server which
>does not check that the default buffer size is sufficient for the
>reply. I add a test script as well.
simple_producer is a very small class, and I see no way it would just
truncate data larger than its buffer size.
class simple_producer:
"producer for a string"
def __init__ (self, data, buffer_size=1024):
self.data = data
self.buffer_size = buffer_size
def more (self):
if len (self.data) > self.buffer_size:
result = self.data[:self.buffer_size]
self.data = self.data[self.buffer_size:]
return result
else:
result = self.data
self.data = ''
return result
(Unless this is a multithreaded program, and two threads are running
the more() method at the same time... in that case more() might well
return bogus results.)
The bug must be somewhere else; maybe something is calling .more()
exactly once and never again. The only relevant caller of more() I
can find is refill_buffer() in asynchat.py, but after a casual
reading, that code looks OK.
Anyone got some more clues?
--amk