From: schlatterbeck Date: Thu, 8 Oct 2009 12:18:47 +0000 (+0000) Subject: Fix bug with SSL-connection and XMLRPC, see my monologue at X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4de70c4242acfe69a181ad91b1cd1bdff2cd5c63;p=roundup.git Fix bug with SSL-connection and XMLRPC, see my monologue at http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/9700 This also fixes a race condition where the forked roundup process would consume 99% CPU resources after the client opens the SSL connection but doesn't send anything, e.g., s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('localhost', 443)) ssl_sock = socket.ssl(s) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4362 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/scripts/roundup_server.py b/roundup/scripts/roundup_server.py index 2eaa5ec..9427c8f 100644 --- a/roundup/scripts/roundup_server.py +++ b/roundup/scripts/roundup_server.py @@ -29,6 +29,8 @@ try: except ImportError: SSL = None +from time import sleep + # python version check from roundup import configuration, version_check from roundup import __version__ as roundup_version @@ -127,9 +129,18 @@ class SecureHTTPServer(BaseHTTPServer.HTTPServer): try: line = self.__fileobj.readline(*args) except SSL.WantReadError: + sleep (.1) line = None return line + def read(self, *args): + """ SSL.Connection can return WantRead """ + while True: + try: + return self.__fileobj.read(*args) + except SSL.WantReadError: + sleep (.1) + def __getattr__(self, attrib): return getattr(self.__fileobj, attrib)