From 75f7d02a7efec77889c20ab18cb94fb3c219e06d Mon Sep 17 00:00:00 2001 From: "ederson.brilhante" Date: Mon, 11 Jul 2016 19:03:32 -0300 Subject: [PATCH] fix healthcheck when there \r\n in midle --- networkapi/plugins/F5/monitor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/networkapi/plugins/F5/monitor.py b/networkapi/plugins/F5/monitor.py index aab40a466..e2de1d196 100644 --- a/networkapi/plugins/F5/monitor.py +++ b/networkapi/plugins/F5/monitor.py @@ -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' @@ -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)