mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 08:03:10 +02:00
* Exclude one-time use parameters. Fixes #6118 * Fix error. * Delete items inplace, rather than creating new list. * Fix stupid mistake. * Use .index() for stability. * Try previous idea while resetting the index. * Shorter comment for pylint. * More readable approach * Fix whitespace
This commit is contained in:
@@ -395,12 +395,17 @@ class NginxParser(object):
|
|||||||
addr.ipv6only = False
|
addr.ipv6only = False
|
||||||
for directive in enclosing_block[new_vhost.path[-1]][1]:
|
for directive in enclosing_block[new_vhost.path[-1]][1]:
|
||||||
if len(directive) > 0 and directive[0] == 'listen':
|
if len(directive) > 0 and directive[0] == 'listen':
|
||||||
if 'default_server' in directive:
|
# Exclude one-time use parameters which will cause an error if repeated.
|
||||||
del directive[directive.index('default_server')]
|
# https://nginx.org/en/docs/http/ngx_http_core_module.html#listen
|
||||||
if 'default' in directive:
|
exclude = set(('default_server', 'default', 'setfib', 'fastopen', 'backlog',
|
||||||
del directive[directive.index('default')]
|
'rcvbuf', 'sndbuf', 'accept_filter', 'deferred', 'bind',
|
||||||
if 'ipv6only=on' in directive:
|
'ipv6only', 'reuseport', 'so_keepalive'))
|
||||||
del directive[directive.index('ipv6only=on')]
|
|
||||||
|
for param in exclude:
|
||||||
|
# See: github.com/certbot/certbot/pull/6223#pullrequestreview-143019225
|
||||||
|
keys = [x.split('=')[0] for x in directive]
|
||||||
|
if param in keys:
|
||||||
|
del directive[keys.index(param)]
|
||||||
return new_vhost
|
return new_vhost
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user