More expansive handling of inconsistent urllib3 exception re-raising

- May be overly broad but the urllib3 behaviour is odd...
- Follow up to e509a864dc
This commit is contained in:
MoojMidge 2025-10-27 09:24:03 +11:00
parent 2c701f800c
commit ddc7b4900b

View file

@ -181,8 +181,11 @@ class RequestHandler(BaseHTTPRequestHandler, object):
return
except (HTTPError, OSError) as exc:
self.close_connection = True
if exc.errno not in self.SWALLOWED_ERRORS:
raise exc
self.log.exception('Request failed')
if (isinstance(exc, HTTPError)
or getattr(exc, 'errno', None) in self.SWALLOWED_ERRORS):
return
raise exc
def ip_address_status(self, ip_address):
is_whitelisted = ip_address in self.whitelist_ips