Skip to content

Commit

Permalink
Merge pull request #259 from Pylons/proxy-header-middleware
Browse files Browse the repository at this point in the history
move proxy headers to a middleware and return 400 for malformed values
  • Loading branch information
digitalresistor committed Jul 25, 2019
2 parents e2210c9 + 0667b8e commit 94e2311
Show file tree
Hide file tree
Showing 13 changed files with 1,295 additions and 1,000 deletions.
14 changes: 14 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[run]
parallel = true
concurrency =
thread
multiprocessing
source =
waitress

omit =
waitress/tests/fixtureapps/getline.py

[report]
show_missing = true
precision = 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.pyc
env*/
.coverage
.coverage.*
.idea/
.tox/
nosetests.xml
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ zip_ok = false

[nosetests]
match=^test
where=waitress
nocapture=1
cover-package=waitress
cover-erase=1
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ envlist =

[testenv]
commands =
nosetests --with-xunit --xunit-file=nosetests-{envname}.xml {posargs:}
nosetests --with-xunit --xunit-file=nosetests-{envname}.xml {posargs:waitress}

extras =
testing
Expand All @@ -21,7 +21,7 @@ extras =

[py-cover]
commands =
coverage run --source=waitress --parallel-mode {envbindir}/nosetests
coverage run {envbindir}/nosetests waitress
coverage combine
coverage xml -o {envname}.xml

Expand All @@ -31,22 +31,23 @@ extras =
[testenv:py27-cover]
commands =
{[py-cover]commands}

setenv =
COVERAGE_FILE=.coverage.py2

[testenv:py35-cover]
commands =
{[py-cover]commands}

setenv =
COVERAGE_FILE=.coverage.py3

[testenv:coverage]
basepython = python3.5
commands =
coverage erase
coverage combine
coverage xml
coverage report --show-missing --fail-under=100 --omit=waitress/tests/fixtureapps/getline.py
coverage report --show-missing --fail-under=100
deps =
coverage
setenv =
Expand Down
7 changes: 5 additions & 2 deletions waitress/adjustments.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import socket
import warnings

from .utilities import PROXY_HEADERS
from .proxy_headers import PROXY_HEADERS
from .compat import (
PY2,
WIN,
Expand All @@ -27,7 +27,10 @@

truthy = frozenset(('t', 'true', 'y', 'yes', 'on', '1'))

KNOWN_PROXY_HEADERS = {header.lower().replace('_', '-') for header in PROXY_HEADERS}
KNOWN_PROXY_HEADERS = frozenset(
header.lower().replace('_', '-')
for header in PROXY_HEADERS
)

def asbool(s):
""" Return the boolean value ``True`` if the case-lowered value of string
Expand Down
Loading

0 comments on commit 94e2311

Please sign in to comment.