Don't report direct network errors as proxy errors

- last commit reported network errors that happened when proxy was off
  as network errors
This commit is contained in:
Peter Šurda 2017-02-20 12:34:55 +01:00
parent ea448c4496
commit 9c4366ffa6
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -445,19 +445,7 @@ class socksocket(socket.socket):
raise raise
self.__negotiatehttp(destpair[0], destpair[1]) self.__negotiatehttp(destpair[0], destpair[1])
elif self.__proxy[0] == None: elif self.__proxy[0] == None:
try:
_orgsocket.connect(self, (destpair[0], destpair[1])) _orgsocket.connect(self, (destpair[0], destpair[1]))
except socket.error as e:
# ENETUNREACH, WSAENETUNREACH
if e[0] in [101, 10051]:
raise GeneralProxyError((7, _generalerrors[7]))
# ECONNREFUSED, WSAECONNREFUSED
if e[0] in [111, 10061]:
raise GeneralProxyError((8, _generalerrors[8]))
# EHOSTUNREACH, WSAEHOSTUNREACH
if e[0] in [113, 10065]:
raise GeneralProxyError((9, _generalerrors[9]))
raise
else: else:
raise GeneralProxyError((4, _generalerrors[4])) raise GeneralProxyError((4, _generalerrors[4]))