]> Raphaƫl G. Git Repositories - youtubedl/blobdiff - youtube_dl/socks.py
New upstream version 2017.02.07
[youtubedl] / youtube_dl / socks.py
index 63d19b3a5214221afa71a6d43bde36a39c13cd4b..0f5d7bdb2128b17c2e1dba3144ff01d9b3d2f06a 100644 (file)
@@ -55,12 +55,12 @@ class Socks5AddressType(object):
     ATYP_IPV6 = 0x04
 
 
-class ProxyError(IOError):
+class ProxyError(socket.error):
     ERR_SUCCESS = 0x00
 
     def __init__(self, code=None, msg=None):
         if code is not None and msg is None:
-            msg = self.CODES.get(code) and 'unknown error'
+            msg = self.CODES.get(code) or 'unknown error'
         super(ProxyError, self).__init__(code, msg)
 
 
@@ -123,7 +123,7 @@ class sockssocket(socket.socket):
         while len(data) < cnt:
             cur = self.recv(cnt - len(data))
             if not cur:
-                raise IOError('{0} bytes missing'.format(cnt - len(data)))
+                raise EOFError('{0} bytes missing'.format(cnt - len(data)))
             data += cur
         return data