Commit 2610dd63 authored by Denis Bilenko's avatar Denis Bilenko

wsgi_test.py: add test cases that send content-length explicitly and trigger...

wsgi_test.py: add test cases that send content-length explicitly and trigger double content-length header bug

Thanks to Jason Toffaletti for providing the test case.
parent 7681268f
......@@ -48,6 +48,21 @@ def hello_world(env, start_response):
return ["hello world"]
def hello_world_explicit_content_length(env, start_response):
if env['PATH_INFO'] == 'notexist':
msg = 'not found'
start_response('404 Not Found',
[('Content-type', 'text/plain'),
('Content-Length', len(msg))])
return [msg]
msg = 'hello world'
start_response('200 OK',
[('Content-type', 'text/plain'),
('Content-Length', len(msg))])
return [msg]
def hello_world_yield(env, start_response):
if env['PATH_INFO'] == 'notexist':
start_response('404 Not Found', [('Content-type', 'text/plain')])
......@@ -251,6 +266,11 @@ class TestHttpdBasic(TestCase):
fd.close()
class TestExplicitContentLength(TestHttpdBasic):
application = staticmethod(hello_world_explicit_content_length)
class TestYield(TestHttpdBasic):
application = staticmethod(hello_world_yield)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment