Skip to content

Commit 6145475

Browse files
committed
add comment explaining SSL Timeout thing
1 parent 3a319b1 commit 6145475

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pytest_httpbin/serve.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ def make_environ(self):
2121
del environ['CONTENT_TYPE']
2222
return environ
2323

24-
class MyThreadedWSGIServer(ThreadedWSGIServer):
24+
class ThreadedWSGIServerWithSSLTimeout(ThreadedWSGIServer):
25+
"""
26+
This whole subclass exists just to set the ssl timeout before wrapping the
27+
socket. That's because on pypy, if there's an SSL failure opening the
28+
connection, it will hang forever.
29+
"""
2530

2631
def __init__(self, *args, **kwargs):
2732
self.protocol = kwargs.pop('protocol')
28-
super(MyThreadedWSGIServer, self).__init__(*args, **kwargs)
33+
super(ThreadedWSGIServerWithSSLTimeout, self).__init__(*args, **kwargs)
2934

3035
def finish_request(self, request, client_address):
3136
"""
@@ -50,7 +55,7 @@ class Server(threading.Thread):
5055

5156
def __init__(self, host='127.0.0.1', port=0, application=None, protocol='http', **kwargs):
5257
self.app = application
53-
self._server = MyThreadedWSGIServer(
58+
self._server = ThreadedWSGIServerWithSSLTimeout(
5459
host,
5560
port,
5661
self.app,

0 commit comments

Comments
 (0)