[Patches] [ python-Patches-410046 ] asynchat: handle excessive response size

noreply@sourceforge.net noreply@sourceforge.net
Tue, 20 Mar 2001 08:32:24 -0800


Patches item #410046, was updated on 2001-03-20 08:32
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=410046&group_id=5470

Category: library
Group: None
Status: Open
Priority: 5
Submitted By: Doug Fort (dougfort)
Assigned to: Nobody/Anonymous (nobody)
Summary: asynchat: handle excessive response size

Initial Comment:
When reading with a numeric terminator, asynchat assumes that if the server didn't send fewer bytes than requested, that it sent exactly the number of bytes requested. This is normally the case, but an overloaded server can return an error message that is  larger than the number of bytes requested. When this  happens asynchttp.handle_read() goes into a tight loop, returning an empty string for data and zero  for a terminator.

This patch raises an exception if the number of bytes returned exceeds the number requested. It's kind of an ugly fix, because asynchttp doesn't raise any other exceptions, and passes on those it catches to handle_error. However, this really is an exceptional case, and the results of not handling it are disastrous.  

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=410046&group_id=5470