mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 16:14:44 +02:00
Support quoted server names in Nginx (#5811)
* Support quoted server names in Nginx * add unit test to check that we strip quotes * update configurator test
This commit is contained in:
@@ -743,7 +743,7 @@ def _parse_server_raw(server):
|
|||||||
if addr.ssl:
|
if addr.ssl:
|
||||||
parsed_server['ssl'] = True
|
parsed_server['ssl'] = True
|
||||||
elif directive[0] == 'server_name':
|
elif directive[0] == 'server_name':
|
||||||
parsed_server['names'].update(directive[1:])
|
parsed_server['names'].update(x.strip('"\'') for x in directive[1:])
|
||||||
elif _is_ssl_on_directive(directive):
|
elif _is_ssl_on_directive(directive):
|
||||||
parsed_server['ssl'] = True
|
parsed_server['ssl'] = True
|
||||||
apply_ssl_to_all_addrs = True
|
apply_ssl_to_all_addrs = True
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ class NginxConfiguratorTest(util.NginxTest):
|
|||||||
self.assertEqual([[['server'],
|
self.assertEqual([[['server'],
|
||||||
[['listen', 'myhost', 'default_server'],
|
[['listen', 'myhost', 'default_server'],
|
||||||
['listen', 'otherhost', 'default_server'],
|
['listen', 'otherhost', 'default_server'],
|
||||||
['server_name', 'www.example.org'],
|
['server_name', '"www.example.org"'],
|
||||||
[['location', '/'],
|
[['location', '/'],
|
||||||
[['root', 'html'],
|
[['root', 'html'],
|
||||||
['index', 'index.html', 'index.htm']]]]],
|
['index', 'index.html', 'index.htm']]]]],
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
server {
|
server {
|
||||||
listen myhost default_server;
|
listen myhost default_server;
|
||||||
listen otherhost default_server;
|
listen otherhost default_server;
|
||||||
server_name www.example.org;
|
server_name "www.example.org";
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root html;
|
root html;
|
||||||
|
|||||||
Reference in New Issue
Block a user