Skip to content

Commit 4623117

Browse files
committed
fix: crash when logging ip if roundup-server times out
Under some conditions (seen in production, no reproducer), if connection timed out, there is no headers attribute RoundupRequestHandler. Check for headers attr before accessing self.headers.
1 parent 7f04d35 commit 4623117

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

roundup/scripts/roundup_server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,9 @@ def address_string(self):
542542
"""
543543
from_forwarded_header=""
544544
forwarded_for = None
545-
if 'X-FORWARDED-FOR' in self.headers:
545+
546+
# if connection timed out, there is no headers property
547+
if hasattr(self, 'headers') and ('X-FORWARDED-FOR' in self.headers):
546548
forwarded_for = re.split(r'[,\s]',
547549
self.headers['X-FORWARDED-FOR'],
548550
maxsplit=1)[0]

0 commit comments

Comments
 (0)