增加HEAD请求异常处理

This commit is contained in:
shmilylty
2019-11-06 01:09:30 +08:00
parent a987b9d96c
commit 3e19062670
2 changed files with 36 additions and 6 deletions
+5 -2
View File
@@ -47,7 +47,10 @@ class Search(Module):
:return: 匹配的子域
:rtype set
"""
resp = requests.head(url, headers=self.header, proxies=self.proxy,
timeout=self.timeout, allow_redirects=False)
resp = self.head(url, allow_redirects=False)
if not resp:
return set()
location = resp.headers.get('location')
if not location:
return set()
return set(utils.match_subdomain(domain, location))