src/eric7/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py

branch
eric7
changeset 9462
e65379fdbd97
parent 9413
80c06d472826
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9461:24c0c1066090 9462:e65379fdbd97
108 path += "/" 108 path += "/"
109 port = urlParts.port 109 port = urlParts.port
110 host = host.strip(".") 110 host = host.strip(".")
111 host = re.sub(r"\.+", ".", host).lower() 111 host = re.sub(r"\.+", ".", host).lower()
112 if host.isdigit(): 112 if host.isdigit():
113 with contextlib.suppress(Exception): 113 with contextlib.suppress(OSError):
114 host = socket.inet_ntoa(struct.pack("!I", int(host))) 114 host = socket.inet_ntoa(struct.pack("!I", int(host)))
115 if host.startswith("0x") and "." not in host: 115 if host.startswith("0x") and "." not in host:
116 with contextlib.suppress(Exception): 116 with contextlib.suppress(OSError):
117 host = socket.inet_ntoa(struct.pack("!I", int(host, 16))) 117 host = socket.inet_ntoa(struct.pack("!I", int(host, 16)))
118 quotedPath = quote(path) 118 quotedPath = quote(path)
119 quotedHost = quote(host) 119 quotedHost = quote(host)
120 if port is not None: 120 if port is not None:
121 quotedHost = "{0}:{1}".format(quotedHost, port) 121 quotedHost = "{0}:{1}".format(quotedHost, port)

eric ide

mercurial