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))
return
try:
http_version = m.group(5).split(' ')[2].split('/')[1]
except:
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]
info = {
'address': m.group(1),