Issue 1310381: httplib : SSL fake sockets to close correctly (original) (raw)
[refers to bug #978833 ; ]
Now I managed to solve the problem for me with attached patch of httplib.py: a explicit shutdown ( 2 or 1 ) of the (faked) ssl'ed socket solves it definitely. I still guess the ssl'ed socket (ssl dll) should do that auto on sock.close() ; there may be still a bug in ssl.c .
the original problem obviously only shows up with FTPS connection (as described in the bug), which relies on correct socket closing and also shows with certain https firewalls/caches which cause a sslerror: (8, 'EOF occurred in violation of protocol') .
*** \usr\src\py24old/httplib.py Sat Sep 24 21:35:28 2005 --- httplib.py Sat Sep 24 21:37:48 2005 *************** class SharedSocket: *** 899,904 **** --- 899,905 ---- self._refcnt -= 1 assert self._refcnt >= 0 if self._refcnt == 0:
self.sock.shutdown(2) self.sock.close() def __del__(self):