Patch: httplib.py default timeout
Skip Montanaro
skip at mojam.com
Tue Dec 28 08:36:55 EST 1999
...
Aahz> defaultTimeout = 60 * 1000 # Sixty seconds
...
def connect(self, host, port = 0, timeout = None):
...
Aahz> if timeout is None:
Aahz> self.sock.setsockopt ( socket.SOL_SOCKET, socket.SO_RCVTIMEO, defaultTimeout )
Aahz> elif timeout > 0:
Aahz> self.sock.setsockopt ( socket.SOL_SOCKET, socket.SO_RCVTIMEO, timeout )
I understand the motivation for the timeout, but shouldn't the default be to
not timeout at all:
defaultTimeout = 0 # wait forever
...
def connect(self, host, port = 0, timeout = defaultTimeout):
? Although timeouts are very useful, they are hardly the norm. Your change
would break code that nominally works now because exceptions could get
raised where none are expected.
Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/
847-971-7098 | Python: Programming the way Guido indented...
More information about the Python-list
mailing list