From 40dc739d09a717cc56f5850ad1cf294d722fcebe Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 18 Mar 2021 14:02:25 +0100 Subject: [PATCH] Even more robust logic in case of missing HTTP version on the logged request - if anything is wrong with the format simply default to http_version = 1.0 --- platypush/backend/log/http.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/platypush/backend/log/http.py b/platypush/backend/log/http.py index 91b36bd7d..bcb648631 100644 --- a/platypush/backend/log/http.py +++ b/platypush/backend/log/http.py @@ -100,12 +100,10 @@ class LogEventHandler(EventHandler): logger.warning('Could not parse log line from {}: {}'.format(file, line)) return - http_version = '1.0' - version_string = m.group(5).split(' ') - if version_string: - version_string = version_string[2].split('/') - if version_string: - http_version = version_string[1] + try: + http_version = m.group(5).split(' ')[2].split('/')[1] + except: + http_version = '1.0' info = { 'address': m.group(1),