Skip to content

Commit

Permalink
Handle exceptions better, do not expect BaseExceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ValdikSS committed Sep 28, 2019
1 parent 7a09a55 commit 8187969
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blockcheck.py
Expand Up @@ -317,11 +317,11 @@ def http_error_302(self, req, fp, code, msg, headers):
finally:
try:
conn.shutdown(socket.SHUT_RDWR)
except:
except Exception:
pass
try:
conn.close()
except:
except Exception:
pass

# SSL Context for urllib
Expand Down Expand Up @@ -397,7 +397,7 @@ def _get_ip_and_isp():
if ip and isp:
isp = urllib.parse.unquote(isp).replace('+', ' ')
return (ip, isp)
except:
except Exception:
return

def _mask_ip(ipaddr):
Expand Down Expand Up @@ -427,7 +427,7 @@ def _dpi_send(host, port, data, fragment_size=0, fragment_count=0):
finally:
try:
sock.shutdown(socket.SHUT_RDWR)
except:
except Exception:
pass
sock.close()
return _decode_bytes(recv)
Expand Down

0 comments on commit 8187969

Please sign in to comment.