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

Created on 2005-06-29 11:39 by cjohns, last changed 2009-07-04 02:26 by ezio.melotti.

Messages (4)
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) 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) 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) Date: 2009-07-04 02:26
In Python3 the code for httplib changed:
Py3:
Lib/http/client.py?view=markup#send">http://svn.python.org/view/python/branches/py3k/Lib/http/client.py?view=markup#send
Py2: Lib/httplib.py?view=markup#send">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)?
History
Date User Action Args
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