From 7d8fb8845f7700b6e81aed2da78513f8c4f773d9 Mon Sep 17 00:00:00 2001 From: Andrew Krasichkov Date: Sat, 13 May 2017 15:10:27 +0300 Subject: [PATCH] Allowed more characters for map/upstream/etc directives --- gixy/parser/raw_parser.py | 6 +++--- tests/parser/test_raw_parser.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gixy/parser/raw_parser.py b/gixy/parser/raw_parser.py index f5fa717..349f3a1 100644 --- a/gixy/parser/raw_parser.py +++ b/gixy/parser/raw_parser.py @@ -135,7 +135,7 @@ def script(self): hash_block << ( keyword + - Group(OneOrMore(space + variable)) + + Group(OneOrMore(space + value)) + Group( left_bracket + Optional(OneOrMore(hash_value)) + @@ -144,7 +144,7 @@ def script(self): generic_block << ( keyword + - Group(ZeroOrMore(space + variable)) + + Group(ZeroOrMore(space + value)) + Group( left_bracket + Optional(sub_block) + @@ -153,7 +153,7 @@ def script(self): unparsed_block << ( keyword + - Group(ZeroOrMore(space + variable)) + + Group(ZeroOrMore(space + value)) + nestedExpr(opener="{", closer="}") )("unparsed_block") diff --git a/tests/parser/test_raw_parser.py b/tests/parser/test_raw_parser.py index 3f14097..c29b7cf 100644 --- a/tests/parser/test_raw_parser.py +++ b/tests/parser/test_raw_parser.py @@ -497,6 +497,22 @@ def test_comments(): assert_config(config, expected) +def test_upstream_dot(): + config = ''' +upstream test.mysite.com { + server 127.0.0.1:9009; +} + ''' + + expected = [ + ['upstream', ['test.mysite.com'], [ + ['server', '127.0.0.1:9009'] + ]], + ] + + assert_config(config, expected) + + def test_empty_config(): config = ''' '''