Skip to content

Commit 340f715

Browse files
committed
Fixed invalid escape sequences
1 parent cbc7f91 commit 340f715

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

gixy/core/builtin_variables.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
BUILTIN_VARIABLES = {
55
# http://nginx.org/en/docs/http/ngx_http_core_module.html#var_uri
6-
'uri': '/[^\x20\t]*',
6+
'uri': r'/[^\x20\t]*',
77
# http://nginx.org/en/docs/http/ngx_http_core_module.html#var_document_uri
8-
'document_uri': '/[^\x20\t]*',
8+
'document_uri': r'/[^\x20\t]*',
99
# http://nginx.org/en/docs/http/ngx_http_core_module.html#var_arg_
10-
'arg_': '[^\s&]+',
10+
'arg_': r'[^\s&]+',
1111
# http://nginx.org/en/docs/http/ngx_http_core_module.html#var_args
12-
'args': '[^\s]+',
12+
'args': r'[^\s]+',
1313
# http://nginx.org/en/docs/http/ngx_http_core_module.html#var_query_string
14-
'query_string': '[^\s]+',
14+
'query_string': r'[^\s]+',
1515
# http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_uri
16-
'request_uri': '/[^\s]*',
16+
'request_uri': r'/[^\s]*',
1717
# http://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_
18-
'http_': '[\x21-\x7e]',
18+
'http_': r'[\x21-\x7e]',
1919

2020
# http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_http_
2121
'upstream_http_': '',

gixy/directives/directive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def variables(self):
115115
class RewriteDirective(Directive):
116116
nginx_name = 'rewrite'
117117
provide_variables = True
118-
boundary = Regexp('[^\s\r\n]')
118+
boundary = Regexp(r'[^\s\r\n]')
119119

120120
def __init__(self, name, args):
121121
super(RewriteDirective, self).__init__(name, args)

gixy/plugins/http_splitting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class http_splitting(Plugin):
7-
"""
7+
r"""
88
Insecure examples:
99
rewrite ^ http://$host$uri;
1010
return 301 http://$host$uri;

gixy/plugins/origins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class origins(Plugin):
11-
"""
11+
r"""
1212
Insecure example:
1313
if ($http_referer !~ "^https?://([^/]+metrika.*yandex\.ru/"){
1414
add_header X-Frame-Options SAMEORIGIN;
@@ -29,7 +29,7 @@ def __init__(self, config):
2929
if self.config.get('domains') and self.config.get('domains')[0] and self.config.get('domains')[0] != '*':
3030
domains = '|'.join(re.escape(d) for d in self.config.get('domains'))
3131
else:
32-
domains = '[^/.]*\.[^/]{2,7}'
32+
domains = r'[^/.]*\.[^/]{2,7}'
3333

3434
scheme = 'https{http}'.format(http=('?' if not self.config.get('https_only') else ''))
3535
regex = r'^{scheme}://(?:[^/.]*\.){{0,10}}(?P<domain>{domains})(?::\d*)?(?:/|\?|$)'.format(

0 commit comments

Comments
 (0)