summaryrefslogtreecommitdiffhomepage
path: root/test/test_settings.py
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2019-03-01 18:30:09 +0300
committerAndrei Belov <defan@nginx.com>2019-03-01 18:30:09 +0300
commit3c3720cba7154bc168cbd00c74817626bb53e140 (patch)
treeda1500f7c6bd5e90ecf45299b6f4b19a29d521cd /test/test_settings.py
parent315a864c27aa27a48c013c4a1ef67a099ffea894 (diff)
parentdf02b03824065389c73213b19736140442cf63bc (diff)
downloadunit-3c3720cba7154bc168cbd00c74817626bb53e140.tar.gz
unit-3c3720cba7154bc168cbd00c74817626bb53e140.tar.bz2
Merged with the default branch.
Diffstat (limited to 'test/test_settings.py')
-rw-r--r--test/test_settings.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/test/test_settings.py b/test/test_settings.py
index b4ac33dc..13bfad49 100644
--- a/test/test_settings.py
+++ b/test/test_settings.py
@@ -14,7 +14,7 @@ class TestUnitSettings(unit.TestUnitApplicationPython):
self.conf({'http': { 'header_read_timeout': 2 }}, 'settings')
(resp, sock) = self.http(b"""GET / HTTP/1.1
-""", start=True, raw=True)
+""", start=True, read_timeout=1, raw=True)
time.sleep(3)
@@ -28,22 +28,20 @@ Connection: close
def test_settings_header_read_timeout_update(self):
self.load('empty')
- r = None
-
self.conf({'http': { 'header_read_timeout': 4 }}, 'settings')
(resp, sock) = self.http(b"""GET / HTTP/1.1
-""", start=True, raw=True, no_recv=True)
+""", start=True, read_timeout=1, raw=True, no_recv=True)
time.sleep(2)
(resp, sock) = self.http(b"""Host: localhost
-""", start=True, sock=sock, raw=True, no_recv=True)
+""", start=True, sock=sock, read_timeout=1, raw=True, no_recv=True)
time.sleep(2)
(resp, sock) = self.http(b"""X-Blah: blah
-""", start=True, sock=sock, raw=True)
+""", start=True, sock=sock, read_timeout=1, raw=True)
if len(resp) != 0:
sock.close()
@@ -68,7 +66,7 @@ Host: localhost
Content-Length: 10
Connection: close
-""", start=True, raw_resp=True, raw=True)
+""", start=True, raw_resp=True, read_timeout=1, raw=True)
time.sleep(3)
@@ -86,15 +84,17 @@ Host: localhost
Content-Length: 10
Connection: close
-""", start=True, raw=True)
+""", start=True, read_timeout=1, raw=True)
time.sleep(2)
- (resp, sock) = self.http(b"""012""", start=True, sock=sock, raw=True)
+ (resp, sock) = self.http(b"""012""", start=True, sock=sock,
+ read_timeout=1, raw=True)
time.sleep(2)
- (resp, sock) = self.http(b"""345""", start=True, sock=sock, raw=True)
+ (resp, sock) = self.http(b"""345""", start=True, sock=sock,
+ read_timeout=1, raw=True)
time.sleep(2)
@@ -120,6 +120,7 @@ Connection: close
Host: localhost
Content-Type: text/html
Content-Length: %d
+Connection: close
""" % data_len + ('X' * data_len)
@@ -142,15 +143,15 @@ Content-Length: %d
self.conf({'http': { 'idle_timeout': 2 }}, 'settings')
(resp, sock) = self.get(headers={
- 'Connection': 'keep-alive',
- 'Host': 'localhost'
- }, start=True)
+ 'Host': 'localhost',
+ 'Connection': 'keep-alive'
+ }, start=True, read_timeout=1)
time.sleep(3)
resp = self.get(headers={
- 'Connection': 'close',
- 'Host': 'localhost'
+ 'Host': 'localhost',
+ 'Connection': 'close'
}, sock=sock)
self.assertEqual(resp['status'], 408, 'status idle timeout')