summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2019-01-03 21:52:33 -0600
committerMichael Merickel <michael@merickel.org>2019-01-03 21:53:14 -0600
commit865b421d4dbdcc3b6524b09e009dbe52fef56df1 (patch)
tree2923562006696c7010d44689c466156d518365a5
parent9a27a242a10c101eb69d7f2dbfd4b048447f8f88 (diff)
downloadwaitress-865b421d4dbdcc3b6524b09e009dbe52fef56df1.tar.gz
allow clear_untrusted_proxy_headers when trusted_proxy is None
fixes #227
-rw-r--r--waitress/adjustments.py13
-rw-r--r--waitress/tests/test_adjustments.py2
2 files changed, 4 insertions, 11 deletions
diff --git a/waitress/adjustments.py b/waitress/adjustments.py
index c1aa66d..fbcfd5f 100644
--- a/waitress/adjustments.py
+++ b/waitress/adjustments.py
@@ -367,17 +367,10 @@ class Adjustments(object):
except:
raise ValueError('Invalid host/port specified.')
- if (
- self.trusted_proxy is None and
- (
- self.trusted_proxy_headers or
- (self.clear_untrusted_proxy_headers is not _bool_marker)
- )
- ):
+ if self.trusted_proxy_headers and self.trusted_proxy is None:
raise ValueError(
- "The values trusted_proxy_headers and clear_untrusted_proxy_headers "
- "have no meaning without setting trusted_proxy. Cowardly refusing to "
- "continue."
+ "trusted_proxy_headers has no meaning without setting "
+ "trusted_proxy"
)
if self.trusted_proxy_headers:
diff --git a/waitress/tests/test_adjustments.py b/waitress/tests/test_adjustments.py
index f841efc..cc0d5de 100644
--- a/waitress/tests/test_adjustments.py
+++ b/waitress/tests/test_adjustments.py
@@ -320,7 +320,7 @@ class TestAdjustments(unittest.TestCase):
self._makeOne(trusted_proxy_headers={'forwarded'})
self.assertIn(
- 'Cowardly refusing to continue.',
+ 'trusted_proxy_headers has no meaning',
str(cm.exception)
)