From 8fc9820dcb92d94457a84d669e2739af33496b32 Mon Sep 17 00:00:00 2001 From: Steffen Beyer Date: Thu, 31 Mar 2011 17:39:24 +0200 Subject: [PATCH] Fix WebDAV socket misbehaviour under BSD for Python >= 2.6 for issue1914 work around http://bugs.python.org/issue7995 --- trytond/protocols/webdav.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trytond/protocols/webdav.py b/trytond/protocols/webdav.py index fcb71568ac..e29fe3d53d 100644 --- a/trytond/protocols/webdav.py +++ b/trytond/protocols/webdav.py @@ -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)