diff options
author | Frank Krick <frank.krick@gmail.com> | 2018-10-28 19:25:33 -0400 |
---|---|---|
committer | Frank Krick <frank.krick@gmail.com> | 2018-10-28 19:25:33 -0400 |
commit | 4320372f5a101bb6c8148c927c02b2db50abb3bb (patch) | |
tree | afa025828d574c43b58facfa22611ea54f34fe5c /waitress | |
parent | 4887c74a9e4228ef69003eb0d3a59cc3abcbbaf6 (diff) | |
download | waitress-4320372f5a101bb6c8148c927c02b2db50abb3bb.tar.gz |
Added check for not mixing unix socket and sockets parameters
Diffstat (limited to 'waitress')
-rw-r--r-- | waitress/adjustments.py | 3 | ||||
-rw-r--r-- | waitress/tests/test_adjustments.py | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/waitress/adjustments.py b/waitress/adjustments.py index c92ba5b..84e4d4a 100644 --- a/waitress/adjustments.py +++ b/waitress/adjustments.py @@ -237,6 +237,9 @@ class Adjustments(object): if 'sockets' in kw and ('host' in kw or 'port' in kw): raise ValueError('host and or port may not be set if sockets is set.') + if 'sockets' in kw and 'unix_socket' in kw: + raise ValueError('unix_socket may not be set if sockets is set') + for k, v in kw.items(): if k not in self._param_map: raise ValueError('Unknown adjustment %r' % k) diff --git a/waitress/tests/test_adjustments.py b/waitress/tests/test_adjustments.py index 64efcf0..dd597df 100644 --- a/waitress/tests/test_adjustments.py +++ b/waitress/tests/test_adjustments.py @@ -263,6 +263,15 @@ class TestAdjustments(unittest.TestCase): sockets=sockets) sockets[0].close() + def test_dont_mix_sockets_and_unix_socket(self): + sockets = [socket.socket(socket.AF_INET, socket.SOCK_STREAM)] + self.assertRaises( + ValueError, + self._makeOne, + unix_socket='./tmp', + sockets=sockets) + sockets[0].close() + def test_badvar(self): self.assertRaises(ValueError, self._makeOne, nope=True) |