Allow non-breaking spaces in nginx config files (#10126)

Fixes @josevavia's issue in #9942.
This commit is contained in:
ohemorange
2025-01-10 15:25:05 -08:00
committed by GitHub
parent f59a639ec4
commit b18c074088
6 changed files with 31 additions and 17 deletions
@@ -35,8 +35,8 @@ class RawNginxParser:
"""A class that parses nginx configuration with pyparsing.""" """A class that parses nginx configuration with pyparsing."""
# constants # constants
space = Optional(White()).leaveWhitespace() space = Optional(White(ws=' \t\r\n\u00a0')).leaveWhitespace()
required_space = White().leaveWhitespace() required_space = White(ws=' \t\r\n\u00a0').leaveWhitespace()
left_bracket = Literal("{").suppress() left_bracket = Literal("{").suppress()
right_bracket = space + Literal("}").suppress() right_bracket = space + Literal("}").suppress()
@@ -362,6 +362,18 @@ class TestRawNginxParser(unittest.TestCase):
parsed = loads("") parsed = loads("")
assert parsed == [] assert parsed == []
def test_non_breaking_spaces(self):
# non-breaking spaces
test = u'\u00a0'
loads(test)
test = """
map $http_upgrade $connection_upgrade {
default upgrade;
''      close;
}
"""
loads(test)
class TestUnspacedList(unittest.TestCase): class TestUnspacedList(unittest.TestCase):
"""Test the UnspacedList data structure""" """Test the UnspacedList data structure"""
+1 -1
View File
@@ -11,7 +11,7 @@ install_requires = [
f'certbot>={version}', f'certbot>={version}',
# pyOpenSSL 23.1.0 is a bad release: https://github.com/pyca/pyopenssl/issues/1199 # pyOpenSSL 23.1.0 is a bad release: https://github.com/pyca/pyopenssl/issues/1199
'PyOpenSSL>=17.5.0,!=23.1.0', 'PyOpenSSL>=17.5.0,!=23.1.0',
'pyparsing>=2.2.1', 'pyparsing>=2.4.7',
] ]
test_extras = [ test_extras = [
+2
View File
@@ -10,10 +10,12 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
### Changed ### Changed
* certbot-nginx now requires pyparsing>=2.4.7.
* *
### Fixed ### Fixed
* Allow nginx plugin to parse non-breaking spaces in nginx configuration files.
* *
More details about these changes can be found on our GitHub repo. More details about these changes can be found on our GitHub repo.
+13 -13
View File
@@ -2,19 +2,19 @@
# that script. # that script.
apacheconfig==0.3.2 ; python_version >= "3.9" and python_version < "3.10" apacheconfig==0.3.2 ; python_version >= "3.9" and python_version < "3.10"
asn1crypto==0.24.0 ; python_version >= "3.9" and python_version < "3.10" asn1crypto==0.24.0 ; python_version >= "3.9" and python_version < "3.10"
astroid==3.3.5 ; python_version >= "3.9" and python_version < "3.10" astroid==3.3.8 ; python_version >= "3.9" and python_version < "3.10"
beautifulsoup4==4.12.3 ; python_version >= "3.9" and python_version < "3.10" beautifulsoup4==4.12.3 ; python_version >= "3.9" and python_version < "3.10"
boto3==1.15.15 ; python_version >= "3.9" and python_version < "3.10" boto3==1.15.15 ; python_version >= "3.9" and python_version < "3.10"
botocore==1.18.15 ; python_version >= "3.9" and python_version < "3.10" botocore==1.18.15 ; python_version >= "3.9" and python_version < "3.10"
cachetools==5.5.0 ; python_version >= "3.9" and python_version < "3.10" cachetools==5.5.0 ; python_version >= "3.9" and python_version < "3.10"
certifi==2024.8.30 ; python_version >= "3.9" and python_version < "3.10" certifi==2024.12.14 ; python_version >= "3.9" and python_version < "3.10"
cffi==1.12.3 ; python_version >= "3.9" and python_version < "3.10" cffi==1.12.3 ; python_version >= "3.9" and python_version < "3.10"
chardet==3.0.4 ; python_version >= "3.9" and python_version < "3.10" chardet==3.0.4 ; python_version >= "3.9" and python_version < "3.10"
cloudflare==1.5.1 ; python_version >= "3.9" and python_version < "3.10" cloudflare==1.5.1 ; python_version >= "3.9" and python_version < "3.10"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.10" and sys_platform == "win32" colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.10" and sys_platform == "win32"
configargparse==1.5.3 ; python_version >= "3.9" and python_version < "3.10" configargparse==1.5.3 ; python_version >= "3.9" and python_version < "3.10"
configobj==5.0.6 ; python_version >= "3.9" and python_version < "3.10" configobj==5.0.6 ; python_version >= "3.9" and python_version < "3.10"
coverage==7.6.8 ; python_version >= "3.9" and python_version < "3.10" coverage==7.6.10 ; python_version >= "3.9" and python_version < "3.10"
cryptography==3.2.1 ; python_version >= "3.9" and python_version < "3.10" cryptography==3.2.1 ; python_version >= "3.9" and python_version < "3.10"
cython==0.29.37 ; python_version >= "3.9" and python_version < "3.10" cython==0.29.37 ; python_version >= "3.9" and python_version < "3.10"
dill==0.3.9 ; python_version >= "3.9" and python_version < "3.10" dill==0.3.9 ; python_version >= "3.9" and python_version < "3.10"
@@ -40,7 +40,7 @@ josepy==1.14.0 ; python_version >= "3.9" and python_version < "3.10"
logger==1.4 ; python_version >= "3.9" and python_version < "3.10" logger==1.4 ; python_version >= "3.9" and python_version < "3.10"
mccabe==0.7.0 ; python_version >= "3.9" and python_version < "3.10" mccabe==0.7.0 ; python_version >= "3.9" and python_version < "3.10"
mypy-extensions==1.0.0 ; python_version >= "3.9" and python_version < "3.10" mypy-extensions==1.0.0 ; python_version >= "3.9" and python_version < "3.10"
mypy==1.13.0 ; python_version >= "3.9" and python_version < "3.10" mypy==1.14.1 ; python_version >= "3.9" and python_version < "3.10"
ndg-httpsclient==0.3.2 ; python_version >= "3.9" and python_version < "3.10" ndg-httpsclient==0.3.2 ; python_version >= "3.9" and python_version < "3.10"
oauth2client==4.1.3 ; python_version >= "3.9" and python_version < "3.10" oauth2client==4.1.3 ; python_version >= "3.9" and python_version < "3.10"
packaging==24.2 ; python_version >= "3.9" and python_version < "3.10" packaging==24.2 ; python_version >= "3.9" and python_version < "3.10"
@@ -54,10 +54,10 @@ py==1.11.0 ; python_version >= "3.9" and python_version < "3.10"
pyasn1-modules==0.4.1 ; python_version >= "3.9" and python_version < "3.10" pyasn1-modules==0.4.1 ; python_version >= "3.9" and python_version < "3.10"
pyasn1==0.4.8 ; python_version >= "3.9" and python_version < "3.10" pyasn1==0.4.8 ; python_version >= "3.9" and python_version < "3.10"
pycparser==2.14 ; python_version >= "3.9" and python_version < "3.10" pycparser==2.14 ; python_version >= "3.9" and python_version < "3.10"
pylint==3.3.2 ; python_version >= "3.9" and python_version < "3.10" pylint==3.3.3 ; python_version >= "3.9" and python_version < "3.10"
pyopenssl==17.5.0 ; python_version >= "3.9" and python_version < "3.10" pyopenssl==17.5.0 ; python_version >= "3.9" and python_version < "3.10"
pyotp==2.9.0 ; python_version >= "3.9" and python_version < "3.10" pyotp==2.9.0 ; python_version >= "3.9" and python_version < "3.10"
pyparsing==2.2.1 ; python_version >= "3.9" and python_version < "3.10" pyparsing==2.4.7 ; python_version >= "3.9" and python_version < "3.10"
pyrfc3339==1.0 ; python_version >= "3.9" and python_version < "3.10" pyrfc3339==1.0 ; python_version >= "3.9" and python_version < "3.10"
pytest-cov==6.0.0 ; python_version >= "3.9" and python_version < "3.10" pytest-cov==6.0.0 ; python_version >= "3.9" and python_version < "3.10"
pytest-xdist==3.6.1 ; python_version >= "3.9" and python_version < "3.10" pytest-xdist==3.6.1 ; python_version >= "3.9" and python_version < "3.10"
@@ -72,7 +72,7 @@ requests-file==2.1.0 ; python_version >= "3.9" and python_version < "3.10"
requests==2.20.0 ; python_version >= "3.9" and python_version < "3.10" requests==2.20.0 ; python_version >= "3.9" and python_version < "3.10"
rsa==4.9 ; python_version >= "3.9" and python_version < "3.10" rsa==4.9 ; python_version >= "3.9" and python_version < "3.10"
s3transfer==0.3.7 ; python_version >= "3.9" and python_version < "3.10" s3transfer==0.3.7 ; python_version >= "3.9" and python_version < "3.10"
setuptools==75.6.0 ; python_version >= "3.9" and python_version < "3.10" setuptools==75.8.0 ; python_version >= "3.9" and python_version < "3.10"
six==1.11.0 ; python_version >= "3.9" and python_version < "3.10" six==1.11.0 ; python_version >= "3.9" and python_version < "3.10"
soupsieve==2.6 ; python_version >= "3.9" and python_version < "3.10" soupsieve==2.6 ; python_version >= "3.9" and python_version < "3.10"
tldextract==5.1.3 ; python_version >= "3.9" and python_version < "3.10" tldextract==5.1.3 ; python_version >= "3.9" and python_version < "3.10"
@@ -80,18 +80,18 @@ tomli==2.2.1 ; python_version >= "3.9" and python_version < "3.10"
tomlkit==0.13.2 ; python_version >= "3.9" and python_version < "3.10" tomlkit==0.13.2 ; python_version >= "3.9" and python_version < "3.10"
tox==1.9.2 ; python_version >= "3.9" and python_version < "3.10" tox==1.9.2 ; python_version >= "3.9" and python_version < "3.10"
types-cryptography==3.3.23.2 ; python_version >= "3.9" and python_version < "3.10" types-cryptography==3.3.23.2 ; python_version >= "3.9" and python_version < "3.10"
types-httplib2==0.22.0.20240310 ; python_version >= "3.9" and python_version < "3.10" types-httplib2==0.22.0.20241221 ; python_version >= "3.9" and python_version < "3.10"
types-pyopenssl==23.0.0.0 ; python_version >= "3.9" and python_version < "3.10" types-pyopenssl==23.0.0.0 ; python_version >= "3.9" and python_version < "3.10"
types-pyrfc3339==2.0.1.20241107 ; python_version >= "3.9" and python_version < "3.10" types-pyrfc3339==2.0.1.20241107 ; python_version >= "3.9" and python_version < "3.10"
types-python-dateutil==2.9.0.20241003 ; python_version >= "3.9" and python_version < "3.10" types-python-dateutil==2.9.0.20241206 ; python_version >= "3.9" and python_version < "3.10"
types-pytz==2024.2.0.20241003 ; python_version >= "3.9" and python_version < "3.10" types-pytz==2024.2.0.20241221 ; python_version >= "3.9" and python_version < "3.10"
types-pywin32==308.0.0.20241128 ; python_version >= "3.9" and python_version < "3.10" types-pywin32==308.0.0.20241221 ; python_version >= "3.9" and python_version < "3.10"
types-requests==2.31.0.6 ; python_version >= "3.9" and python_version < "3.10" types-requests==2.31.0.6 ; python_version >= "3.9" and python_version < "3.10"
types-setuptools==75.6.0.20241126 ; python_version >= "3.9" and python_version < "3.10" types-setuptools==75.8.0.20250110 ; python_version >= "3.9" and python_version < "3.10"
types-urllib3==1.26.25.14 ; python_version >= "3.9" and python_version < "3.10" types-urllib3==1.26.25.14 ; python_version >= "3.9" and python_version < "3.10"
typing-extensions==4.12.2 ; python_version >= "3.9" and python_version < "3.10" typing-extensions==4.12.2 ; python_version >= "3.9" and python_version < "3.10"
uritemplate==3.0.1 ; python_version >= "3.9" and python_version < "3.10" uritemplate==3.0.1 ; python_version >= "3.9" and python_version < "3.10"
urllib3==1.24.2 ; python_version >= "3.9" and python_version < "3.10" urllib3==1.24.2 ; python_version >= "3.9" and python_version < "3.10"
virtualenv==20.28.0 ; python_version >= "3.9" and python_version < "3.10" virtualenv==20.28.1 ; python_version >= "3.9" and python_version < "3.10"
wheel==0.45.1 ; python_version >= "3.9" and python_version < "3.10" wheel==0.45.1 ; python_version >= "3.9" and python_version < "3.10"
zipp==3.21.0 ; python_version >= "3.9" and python_version < "3.10" zipp==3.21.0 ; python_version >= "3.9" and python_version < "3.10"
+1 -1
View File
@@ -71,7 +71,7 @@ pyOpenSSL = "17.5.0"
pyRFC3339 = "1.0" pyRFC3339 = "1.0"
pyasn1 = "0.4.8" pyasn1 = "0.4.8"
pycparser = "2.14" pycparser = "2.14"
pyparsing = "2.2.1" pyparsing = "2.4.7"
python-augeas = "0.5.0" python-augeas = "0.5.0"
python-digitalocean = "1.11" python-digitalocean = "1.11"
pytz = "2019.3" pytz = "2019.3"