Fix inetd mode on Python 2.
In python 2 the ssl.wrap_socket doesn't work on sockets created using socket.fromfd. The workaround is to wrap the socket returned by socket.fromfd into another socket object using the private _sock constructor parameter.
This commit is contained in:
parent
867cb21ba0
commit
2c0e8cb8f4
|
@ -676,6 +676,10 @@ class WebSockifyServer(object):
|
|||
|
||||
if self.listen_fd != None:
|
||||
lsock = socket.fromfd(self.listen_fd, socket.AF_INET, socket.SOCK_STREAM)
|
||||
if sys.hexversion < 0x3000000:
|
||||
# For python 2 we have to wrap the "raw" socket into a socket object,
|
||||
# otherwise ssl wrap_socket doesn't work.
|
||||
lsock = socket.socket(_sock=lsock)
|
||||
else:
|
||||
lsock = self.socket(self.listen_host, self.listen_port, False,
|
||||
self.prefer_ipv6,
|
||||
|
|
Loading…
Reference in New Issue