1def application(environ, start_response): 2 body = [] 3 content_length = 0 4 5 while True: 6 l = environ['wsgi.input'].readline() 7 if not l: 8 break 9 10 body.append(l) 11 content_length += len(l) 12 13 start_response( 14 '200', 15 [ 16 ('Content-Length', str(content_length)), 17 ('X-Lines-Count', str(len(body))), 18 ], 19 ) 20 return body 21