Ticket #314 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

SecureHTTPServer is incompatible with Python 2.6

Reported by: jkp Owned by: ianb
Priority: high Milestone: 1.4.1
Component: paste Version: svn-trunk
Severity: normal Keywords: httpserver ssl 2.6
Cc:

Description

If you start the httpserver in secure mode with Python 2.6 the following error occurs:

Traceback (most recent call last):
  File "main.py", line 330, in <module>
    app.run()
  File "main.py", line 302, in run
    self.serve()
  File "main.py", line 245, in serve
    self.server.serve_forever()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Paste-1.7.2-py2.6.egg/paste/httpserver.py", line 1078, in serve_forever
    self.handle_request()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 257, in handle_request
    timeout = self.socket.gettimeout()
AttributeError: TSafeConnection instance has no attribute 'gettimeout'

Adding the following code to the TSafeConnection class fixes the issue:

class TSafeConnection(tsafe.Connection):
    def settimeout(self, *args):
        self._lock.acquire()
        try:
            return self._ssl_conn.settimeout(*args)
        finally:
            self._lock.release()
    def gettimeout(self):
        self._lock.acquire()
        try:
            return self._ssl_conn.gettimeout()
        finally:
            self._lock.release()     

Attachments

httpserver-ssl2.6.patch Download (0.7 KB) - added by jkp 3 years ago.
Patch to fix SSL support in Python 2.6

Change History

Changed 3 years ago by jkp

Patch to fix SSL support in Python 2.6

Changed 3 years ago by ianb

  • status changed from new to closed
  • resolution set to fixed

Fixed in r7641

Note: See TracTickets for help on using tickets.