[Patches] [ python-Patches-516715 ] HTTPConnection.send() fails large reques

noreply@sourceforge.net noreply@sourceforge.net
Fri, 15 Feb 2002 16:16:35 -0800


Patches item #516715, was opened at 2002-02-12 15:44
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=516715&group_id=5470

Category: Library (Lib)
Group: Python 2.1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: James Rucker (jamesrucker)
Assigned to: Nobody/Anonymous (nobody)
Summary: HTTPConnection.send() fails large reques

Initial Comment:
The present implementation of HTTPConnection.send() in
httplib.py does not handle the case of less than the
number of requested bytes being sent via socket.send().

Indeed, this condition occurs for fairly large
requests.  In my environment, socket.send() will max
out at transferring 33011 bytes.

The routine needs to check how many bytes where
actually  transferred and make subsequent socket.send()
calls until all of the data makes it through.  In the
patch I've supplied, I send slices of a particular
maximum size in each iteration, rather than attempting
to send the entire remainder of data, for efficiency
(it proved expensive to have big slices being created
per call, which would happen otherwise).

I noticed that in the description of recent patches it
appears that an attempt has made to address this, but
the version of httplib.py that supposedly provides a
fix appears to make invalid references to socket.py. 
If what's there is actually suitable, please do disregard.

The submitted diff is against version 1.34.2.1


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

>Comment By: Martin v. Löwis (loewis)
Date: 2002-02-15 16:16

Message:
Logged In: YES 
user_id=21627

I fail to see a problem in the current code. What does "max
out" mean exactly? There shouldn't be a problem passing an
arbitrarily large block of data to the send system call,
atleast not over a TCP connection. What operating system are
you using, and what is the precise error that you get with
the  current code?

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

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