diff options
author | ipknHama <ipknhama@gmail.com> | 2016-09-10 01:57:09 +0900 |
---|---|---|
committer | ipknHama <ipknhama@gmail.com> | 2016-09-10 01:57:09 +0900 |
commit | 60c16934cde9da606b86ddce20cc045837d5c8fa (patch) | |
tree | f9a6142cc0d25dd17eb1a88fef1b814f7b3843b9 /examples/example_test.py | |
parent | 031f850b94d132885e4b293864897f742cc9f28a (diff) | |
download | crow-60c16934cde9da606b86ddce20cc045837d5c8fa.tar.gz crow-60c16934cde9da606b86ddce20cc045837d5c8fa.zip |
Add a testcase for large response + Connection:close header
Diffstat (limited to 'examples/example_test.py')
-rw-r--r-- | examples/example_test.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/examples/example_test.py b/examples/example_test.py index e2bf651..d252df0 100644 --- a/examples/example_test.py +++ b/examples/example_test.py @@ -18,11 +18,27 @@ for i in xrange(10): Host: localhost\r\n\r\n'''); assert 'Hello World!' in s.recv(1024) +# test large +s = socket.socket() +s.connect(('localhost', 18080)) +s.send('''GET /large HTTP/1.1 +Host: localhost\r\nConnection: close\r\n\r\n''') +r = '' +while True: + d = s.recv(1024*1024) + if not d: + break; + r += d + print len(r), len(d) +print len(r), r[:100] +assert len(r) > 512*1024 + # test timeout s = socket.socket() s.connect(('localhost', 18080)) -print 'ERROR REQUEST' +# invalid request, connection will be closed after timeout s.send('''GET / HTTP/1.1 hHhHHefhwjkefhklwejfklwejf ''') print s.recv(1024) + |