xref: /unit/test/python/threads/wsgi.py (revision 1971:3410f9d2a662)
1import threading
2import time
3
4
5def application(environ, start_response):
6    delay = float(environ.get('HTTP_X_DELAY', 0))
7
8    time.sleep(delay)
9
10    start_response(
11        '200',
12        [
13            ('Content-Length', '0'),
14            ('Wsgi-Multithread', str(environ['wsgi.multithread'])),
15            ('X-Thread', str(threading.currentThread().ident)),
16        ],
17    )
18
19    return []
20