[ python-Bugs-1153016 ] Setting socket timeout crashes SSL

SourceForge.net noreply at sourceforge.net
Thu May 19 15:53:11 CEST 2005


Bugs item #1153016, was opened at 2005-02-27 19:41
Message generated for change (Comment added) made by tarek-ziade
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1153016&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: pristine777 (pristine777)
Assigned to: Nobody/Anonymous (nobody)
Summary: Setting socket timeout crashes SSL

Initial Comment:
This bug was fixed in Python 2.3 but has resurfaced in 
Python 2.4

The original bug report can be found at: 
https://sourceforge.net/tracker/?
func=detail&atid=105470&aid=673797&group_id=5470

The method urlopen both in urllib and in urllib2 crashes 
if socket.setdefaulttimeout has been called. Below is a 
cut and paste when using the function in urllib.


>>> import socket
>>> socket.setdefaulttimeout(30.0)
>>> import urllib
>>> urllib.urlopen('https://members.tufts-
health.com/memindex.html')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\lib\urllib.py", line 77, in urlopen
    return opener.open(url)
  File "C:\Python24\lib\urllib.py", line 180, in open
    return getattr(self, name)(url)
  File "C:\Python24\lib\urllib.py", line 374, in open_https
    h.endheaders()
  File "C:\Python24\lib\httplib.py", line 794, in 
endheaders
    self._send_output()
  File "C:\Python24\lib\httplib.py", line 675, in 
_send_output
    self.send(msg)
  File "C:\Python24\lib\httplib.py", line 642, in send
    self.connect()
  File "C:\Python24\lib\httplib.py", line 1069, in connect
    ssl = socket.ssl(sock, self.key_file, self.cert_file)
  File "C:\Python24\lib\socket.py", line 74, in ssl
    return _realssl(sock, keyfile, certfile)
IOError: [Errno socket error] (2, 'The operation did not 
complete (read)')

Thanks a ton!

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

Comment By: Tarek Ziadé (tarek-ziade)
Date: 2005-05-19 13:53

Message:
Logged In: YES 
user_id=1163510

having same issue here, using imaplib thru ssl :/

>>> import socket
>>> socket.setdefaulttimeout(10)
>>> i = imaplib.IMAP4_SSL('mail.xxxx.com')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/imaplib.py", line 1101, in __init__
    IMAP4.__init__(self, host, port)
  File "/usr/lib/python2.4/imaplib.py", line 181, in __init__
    self.welcome = self._get_response()
  File "/usr/lib/python2.4/imaplib.py", line 876, in
_get_response
    resp = self._get_line()
  File "/usr/lib/python2.4/imaplib.py", line 969, in _get_line
    line = self.readline()
  File "/usr/lib/python2.4/imaplib.py", line 1136, in readline
    char = self.sslobj.read(1)
socket.sslerror: The read operation timed out

so i can't get timeouts with ssl in imap :/

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1153016&group_id=5470


More information about the Python-bugs-list mailing list