Fix WebDAV socket misbehaviour under BSD for Python >= 2.6 for issue1914

work around http://bugs.python.org/issue7995
This commit is contained in:
Steffen Beyer committed 2011-03-31 17:39:24 +02:00
1 parent 2fad5e05de
commit 8fc9820dcb
1 file changed
+4 -1
+4 -1
View File
@@ -82,7 +82,10 @@ class BaseThreadedHTTPServer(SocketServer.ThreadingMixIn,
def server_bind(self):
# Python < 2.6 doesn't handle self.timeout
self.socket.settimeout(1)
if sys.version_info < (2, 6):
# breaks the socket under BSD, see http://bugs.python.org/issue7995
self.socket.settimeout(1)
self.socket.setsockopt(socket.SOL_SOCKET,
socket.SO_REUSEADDR, 1)
BaseHTTPServer.HTTPServer.server_bind(self)