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

This commit is contained in:
Fabio Manganiello 2021-03-18 14:02:25 +01:00
parent 4821fe086b
commit 40dc739d09

View file

@ -100,12 +100,10 @@ class LogEventHandler(EventHandler):
logger.warning('Could not parse log line from {}: {}'.format(file, line)) logger.warning('Could not parse log line from {}: {}'.format(file, line))
return return
http_version = '1.0' try:
version_string = m.group(5).split(' ') http_version = m.group(5).split(' ')[2].split('/')[1]
if version_string: except:
version_string = version_string[2].split('/') http_version = '1.0'
if version_string:
http_version = version_string[1]
info = { info = {
'address': m.group(1), 'address': m.group(1),