From 7ce9f61cb66ddd78e2a6778970cd7c4845c79f00 Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Thu, 14 Feb 2019 16:09:19 +0300 Subject: Tests: minor fixes. --- test/test_settings.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'test/test_settings.py') diff --git a/test/test_settings.py b/test/test_settings.py index b4ac33dc..d272f701 100644 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -28,8 +28,6 @@ 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 -- cgit From 4de2c8b56719fce6b95b6f8a613b349590a3676f Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Wed, 27 Feb 2019 19:15:02 +0300 Subject: Tests: added "Host" and "Connetion" headers where necessary. Also minor header organizing. --- test/test_settings.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test/test_settings.py') diff --git a/test/test_settings.py b/test/test_settings.py index d272f701..324042f9 100644 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -118,6 +118,7 @@ Connection: close Host: localhost Content-Type: text/html Content-Length: %d +Connection: close """ % data_len + ('X' * data_len) @@ -140,15 +141,15 @@ Content-Length: %d self.conf({'http': { 'idle_timeout': 2 }}, 'settings') (resp, sock) = self.get(headers={ - 'Connection': 'keep-alive', - 'Host': 'localhost' + 'Host': 'localhost', + 'Connection': 'keep-alive' }, start=True) 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') -- cgit From bd77c9a4d2b0f6f609e033060a5486c0afe6b19e Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Wed, 27 Feb 2019 19:43:14 +0300 Subject: Tests: read_timeout option introduced. Also, increased default select() timeout from 1s to 5s. --- test/test_settings.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'test/test_settings.py') diff --git a/test/test_settings.py b/test/test_settings.py index 324042f9..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) @@ -31,17 +31,17 @@ Connection: close 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() @@ -66,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) @@ -84,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) @@ -143,7 +145,7 @@ Connection: close (resp, sock) = self.get(headers={ 'Host': 'localhost', 'Connection': 'keep-alive' - }, start=True) + }, start=True, read_timeout=1) time.sleep(3) -- cgit