summaryrefslogtreecommitdiffhomepage
path: root/test/python/threads/wsgi.py
blob: 1cc8ffe27fed6be73c6d508c4cb48cb13fbad989 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import time
import threading

def application(environ, start_response):
    delay = float(environ.get('HTTP_X_DELAY', 0))

    time.sleep(delay)

    start_response('200', [
        ('Content-Length', '0'),
        ('Wsgi-Multithread', str(environ['wsgi.multithread'])),
        ('X-Thread', str(threading.currentThread().ident))
    ])

    return []