# HG changeset patch # User John Rouillard # Date 1735771865 18000 # Node ID 3a04ff6f1004b4ec5729021dc0db0b10719f83c6 # Parent 7d72b9a9fe9c70cdfbf410228e338bc5b1d80506 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. diff -r 7d72b9a9fe9c -r 3a04ff6f1004 roundup/scripts/roundup_server.py --- a/roundup/scripts/roundup_server.py Wed Jan 01 15:48:01 2025 -0500 +++ b/roundup/scripts/roundup_server.py Wed Jan 01 17:51:05 2025 -0500 @@ -542,7 +542,9 @@ """ from_forwarded_header="" forwarded_for = None - if 'X-FORWARDED-FOR' in self.headers: + + # if connection timed out, there is no headers property + if hasattr(self, 'headers') and ('X-FORWARDED-FOR' in self.headers): forwarded_for = re.split(r'[,\s]', self.headers['X-FORWARDED-FOR'], maxsplit=1)[0]