diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2019-09-03 21:23:32 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2019-09-03 21:23:32 +0300 |
commit | 3e23afb0d205e503f6cc7d852e34d07da9a5b7f7 (patch) | |
tree | a3c9a894eaea9d14d2bd466f58cd809fea29487d /test/unit/applications | |
parent | daadc2e00bc47498513929549bf0364070a1557c (diff) | |
download | unit-3e23afb0d205e503f6cc7d852e34d07da9a5b7f7.tar.gz unit-3e23afb0d205e503f6cc7d852e34d07da9a5b7f7.tar.bz2 |
Tests: increased read_timeout for websockets tests.
Diffstat (limited to 'test/unit/applications')
-rw-r--r-- | test/unit/applications/websockets.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/unit/applications/websockets.py b/test/unit/applications/websockets.py index 5f9c3c51..50ff2797 100644 --- a/test/unit/applications/websockets.py +++ b/test/unit/applications/websockets.py @@ -57,7 +57,7 @@ class TestApplicationWebsocket(TestApplicationProto): def serialize_close(self, code=1000, reason=''): return struct.pack('!H', code) + reason.encode('utf-8') - def frame_read(self, sock, read_timeout=10): + def frame_read(self, sock, read_timeout=30): def recv_bytes(sock, bytes): data = b'' while select.select([sock], [], [], read_timeout)[0]: @@ -91,7 +91,11 @@ class TestApplicationWebsocket(TestApplicationProto): if frame['mask']: mask_bits = recv_bytes(sock, 4) - data = recv_bytes(sock, length) + data = b'' + + if length != 0: + data = recv_bytes(sock, length) + if frame['mask']: data = self.apply_mask(data, mask_bits) |