aboutsummaryrefslogtreecommitdiffstats
path: root/examples/example_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example_test.py')
-rw-r--r--examples/example_test.py18
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)
+