From 07b600a3c17ebc886be69a97807114b16e5e4956 Mon Sep 17 00:00:00 2001 From: Abigail Egea Amugu Date: Fri, 19 Jun 2015 15:58:40 -0700 Subject: [PATCH 1/2] Added support for multiple headers via config list --- hacheck/checker.py | 4 +--- hacheck/config.py | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hacheck/checker.py b/hacheck/checker.py index 45551a9..4963b4e 100644 --- a/hacheck/checker.py +++ b/hacheck/checker.py @@ -16,8 +16,6 @@ TIMEOUT = 10 -HTTP_HEADERS_TO_COPY = ('Host',) - class Timeout(Exception): pass @@ -84,7 +82,7 @@ def check_http(service_name, port, check_path, io_loop, query_params, headers): if not check_path.startswith("/"): check_path = "/" + check_path # pragma: no cover headers_out = {'User-Agent': 'hastate %s' % (__version__)} - for header in HTTP_HEADERS_TO_COPY: + for header in config.config['http_headers_to_copy']: if header in headers: headers_out[header] = headers[header] if config.config['service_name_header']: diff --git a/hacheck/config.py b/hacheck/config.py index 58e869b..09608fc 100644 --- a/hacheck/config.py +++ b/hacheck/config.py @@ -14,7 +14,8 @@ def max_or_int(some_str_value): 'log_path': (str, 'stderr'), 'mysql_username': (str, None), 'mysql_password': (str, None), - 'rlimit_nofile': (max_or_int, None) + 'rlimit_nofile': (max_or_int, None), + 'http_headers_to_copy': (list, 'Host') } From 7dbb2cde084b9d4f4b1eca18eb2391428da4e404 Mon Sep 17 00:00:00 2001 From: Abigail Egea Amugu Date: Mon, 22 Jun 2015 12:10:20 -0700 Subject: [PATCH 2/2] Changed default header to be a list rather than a str --- hacheck/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hacheck/config.py b/hacheck/config.py index 09608fc..8a3cb77 100644 --- a/hacheck/config.py +++ b/hacheck/config.py @@ -15,7 +15,7 @@ def max_or_int(some_str_value): 'mysql_username': (str, None), 'mysql_password': (str, None), 'rlimit_nofile': (max_or_int, None), - 'http_headers_to_copy': (list, 'Host') + 'http_headers_to_copy': (list, ['Host']) }