Skip to content

Commit b89d9ab

Browse files
authored
Merge pull request qiyeboy#82 from xsren/master
update _checkHttpProxy func
2 parents a96725d + 09139db commit b89d9ab

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

validator/Validator.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,15 @@ def _checkHttpProxy(selfip, proxies, isHttp=True):
145145
content = json.loads(r.text)
146146
headers = content['headers']
147147
ip = content['origin']
148-
x_forwarded_for = headers.get('X-Forwarded-For', None)
149-
x_real_ip = headers.get('X-Real-Ip', None)
150-
if selfip in ip or ',' in ip:
151-
return False, types, speed
152-
elif x_forwarded_for is None and x_real_ip is None:
153-
types = 0
154-
elif selfip not in x_forwarded_for and selfip not in x_real_ip:
148+
proxy_connection = headers.get('Proxy-Connection', None)
149+
150+
if ',' in ip:
151+
types = 2
152+
elif proxy_connection:
155153
types = 1
156154
else:
157-
types = 2
155+
types = 0
156+
158157
return True, types, speed
159158
else:
160159
return False, types, speed

0 commit comments

Comments
 (0)