xref: /unit/test/python/input_readline_size/wsgi.py (revision 1400:cbd75efbfb74)
1*1400Smax.romanov@nginx.comdef application(environ, start_response):
2*1400Smax.romanov@nginx.com    body = []
3*1400Smax.romanov@nginx.com
4*1400Smax.romanov@nginx.com    while True:
5*1400Smax.romanov@nginx.com        l = environ['wsgi.input'].readline(9)
6*1400Smax.romanov@nginx.com        if not l:
7*1400Smax.romanov@nginx.com            break
8*1400Smax.romanov@nginx.com
9*1400Smax.romanov@nginx.com        body.append(l)
10*1400Smax.romanov@nginx.com
11*1400Smax.romanov@nginx.com        if len(l) > 9:
12*1400Smax.romanov@nginx.com            body.append(b'len(l) > 9: ' + l)
13*1400Smax.romanov@nginx.com            break
14*1400Smax.romanov@nginx.com
15*1400Smax.romanov@nginx.com    start_response('200', [('X-Lines-Count', str(len(body)))])
16*1400Smax.romanov@nginx.com    return body
17