Skip to content

Commit

Permalink
fix healthcheck when there \r\n in midle
Browse files Browse the repository at this point in the history
  • Loading branch information
ederson.brilhante committed Jul 11, 2016
1 parent 08d9d5f commit 75f7d02
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions networkapi/plugins/F5/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def prepare_template(self, **kwargs):
if not valid_regex(hr, rg):
hr = 'GET ' + hr

# do escape when healthcheck has simple \r\n
rg = '((\\r\\n))'
if valid_regex(hr, rg):
log.debug('adding unicode-escape')
hr = hr.encode('unicode-escape')

# add HTTP/1.\\r\\n\\r\\n when plugin no receive in
# healthcheck
rg = 'HTTP\/1'
Expand All @@ -81,12 +87,6 @@ def prepare_template(self, **kwargs):
log.debug('adding \\r\\n\\r\\n')
hr = hr + '\\r\\n\\r\\n'

# do escape when healthcheck has simple \r\n\r\n
rg = '(?:((\\r\\n)){1,2}?)$'
if valid_regex(hr, rg):
log.debug('adding unicode-escape')
hr = hr.encode('unicode-escape')

healthcheck_request = hr

template_names.append(name)
Expand Down

0 comments on commit 75f7d02

Please sign in to comment.