fix #1249: catch exceptions when requesting with disabling allow_redirects

This commit is contained in:
debugtalk
2022-04-18 13:38:09 +08:00
parent 77790e13d4
commit 6e4da54250
3 changed files with 76 additions and 3 deletions

View File

@@ -189,10 +189,11 @@ class HttpSession(requests.Session):
try:
server_ip, server_port = response.raw._connection.sock.getpeername()
except Exception:
self.data.address.server_ip = server_ip
self.data.address.server_port = server_port
logger.debug(f"server IP: {server_ip}, Port: {server_port}")
except Exception:
pass
# get length of the response content
content_size = int(dict(response.headers).get("content-length") or 0)