From dd8738a4f1bd0772b2a2481ae801e1fc2e02f990 Mon Sep 17 00:00:00 2001 From: daniel goldberg Date: Thu, 25 Aug 2016 16:27:29 +0300 Subject: [PATCH] Fixed collision where HTTP auto upgraded to HTTPS --- chaos_monkey/network/httpfinger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chaos_monkey/network/httpfinger.py b/chaos_monkey/network/httpfinger.py index 89cab3f65..b6f9ad887 100644 --- a/chaos_monkey/network/httpfinger.py +++ b/chaos_monkey/network/httpfinger.py @@ -27,11 +27,12 @@ class HTTPFinger(HostFinger): https = "https://" + host.ip_addr + ":" + port[1] # try http, we don't optimise for 443 - for url in (http, https): + for url in (https, http): # start with https and downgrade try: with closing(get(url, verify=False, timeout=1, stream=True)) as req: server = req.headers.get('Server') - host.services['tcp-' + port[1]] = server + ssl = True if 'https://' in url else False + host.services['tcp-' + port[1]] = (server,ssl) break # https will be the same on the same port except Timeout: pass