Browse Source

fix: client stop socks connection first

master
Dnomd343 3 years ago
parent
commit
96050ac8da
  1. 6
      ProxyChecker/Http.py
  2. 2
      check.py

6
ProxyChecker/Http.py

@ -25,10 +25,6 @@ def httpPing(port, url = 'http://gstatic.com/generate_204', timeout = 30):
return None, 'Missing modules' return None, 'Missing modules'
except requests.exceptions.InvalidSchema: # 缺失pysocks包 except requests.exceptions.InvalidSchema: # 缺失pysocks包
return None, 'Missing dependencies for SOCKS support' return None, 'Missing dependencies for SOCKS support'
except requests.exceptions.ConnectionError: # socks端口出错
return None, 'Unable to connect socks5 proxy'
except requests.exceptions.ProxyError: # socks代理出错
return None, 'Unable to connect socks5 proxy'
except requests.exceptions.ConnectTimeout: # 请求超时 except requests.exceptions.ConnectTimeout: # 请求超时
return False, 'Request timeout' return False, 'Request timeout'
except requests.exceptions.ReadTimeout: # 请求超时 except requests.exceptions.ReadTimeout: # 请求超时
@ -36,7 +32,7 @@ def httpPing(port, url = 'http://gstatic.com/generate_204', timeout = 30):
except requests.exceptions.Timeout: # 请求超时 except requests.exceptions.Timeout: # 请求超时
return False, 'Request timeout' return False, 'Request timeout'
except: # 未知错误 except: # 未知错误
return None, 'Unknown error' return False, 'Request error'
try: try:
statusCode = httpRequest.status_code # 获取http状态码 statusCode = httpRequest.status_code # 获取http状态码

2
check.py

@ -58,7 +58,7 @@ def loadDir(folderPath): # 创建文件夹
def proxyHttpCheck(socksPort): # Http检测 def proxyHttpCheck(socksPort): # Http检测
try: try:
health, httpDelay = Checker.httpCheck(socksPort, timeout = 10) health, httpDelay = Checker.httpCheck(socksPort, timeout = 12)
if health == None: # 连接失败 if health == None: # 连接失败
return None return None
return { return {

Loading…
Cancel
Save