classification
Title: httplib error checking.
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gward Nosy List: BreamoreBoy, cjohns, ezio.melotti, georg.brandl, gward, vila
Priority: normal Keywords:

Created on 2005-06-29 11:39 by cjohns, last changed 2010-08-21 16:50 by BreamoreBoy. This issue is now closed.

Messages (5)
msg25676 - (view) Author: Chris Johns (cjohns) Date: 2005-06-29 11:39
The httplib does not seem to handle error codes cleanly
or in a portable way. The socket could return a
ECONNRESET and does on the RTEMS platform. Also value
32 is normally EPIPE, but ECONNRESET is different so
the Python errno should be used.

 [please excuse the manual diff :-)]

line 657:
<           if v[0] == 32:      # Broken pipe
line 657:
>           if v[0] == errno.EPIPE or v[0] ==
errno.ECONNRESET:


line 803:
>           if v[0] != 32 or not self.auto_open:
line 803:
>            if (v[0] != errno.EPIPE and v[0] !=
errno.ECONNRESET) or not self.auto_open:

I can provide a patch if this change make sense.
msg25677 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-07-02 10:50
Logged In: YES 
user_id=1188172

Can someone judge if this makes sense?
msg25678 - (view) Author: Greg Ward (gward) (Python committer) Date: 2006-07-24 21:04
Logged In: YES 
user_id=14422

Yes, this bug report absolutely makes sense.  httplib.py
hardcodes errno values, e.g. it uses 32 when it should use
errno.EPIPE.  Bogus.  IMHO this can and should be fixed.

Adding checks for ECONNRESET at the same time as checking
for EPIPE seems OK to me, but I'm not really sure.  I'll try
to whip up a patch.
msg90098 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-07-04 02:26
In Python3 the code for httplib changed:
Py3:
http://svn.python.org/view/python/branches/py3k/Lib/http/client.py?view=markup#send
Py2: http://svn.python.org/view/python/trunk/Lib/httplib.py?view=markup#send

Does this still need to be fixed on Py2.7 (and maybe on Py3 too)?
msg114511 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-21 16:50
The offending code has already been removed from all Python versions.
History
Date User Action Args
2010-08-21 16:50:29BreamoreBoysetstatus: open -> closed

nosy: + BreamoreBoy
messages: + msg114511

resolution: fixed
2009-07-04 02:26:48ezio.melottisetversions: + Python 2.7, - Python 2.4
nosy: + ezio.melotti

messages: + msg90098

type: behavior
2008-01-05 14:09:27vilasetnosy: + vila
2005-06-29 11:39:26cjohnscreate