mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-01 18:21:30 +08:00
29 lines
669 B
Python
29 lines
669 B
Python
#
|
|
# This file is part of gunicorn released under the MIT license.
|
|
# See the NOTICE for more information.
|
|
|
|
# Simple WSGI app for benchmarking
|
|
|
|
import time
|
|
|
|
|
|
def application(environ, start_response):
|
|
"""Basic hello world response."""
|
|
path = environ.get('PATH_INFO', '/')
|
|
|
|
if path == '/large':
|
|
body = b'X' * 65536 # 64KB
|
|
elif path == '/slow':
|
|
time.sleep(0.01) # 10ms simulated I/O
|
|
body = b'Slow response'
|
|
else:
|
|
body = b'Hello, World!'
|
|
|
|
status = '200 OK'
|
|
headers = [
|
|
('Content-Type', 'text/plain'),
|
|
('Content-Length', str(len(body))),
|
|
]
|
|
start_response(status, headers)
|
|
return [body]
|