update + fix

This commit is contained in:
2023-10-24 23:45:09 +02:00
parent 577fa39263
commit afb27bd33d
10 changed files with 691 additions and 219 deletions

View File

@@ -247,11 +247,14 @@ class HttpFileServer(HTTPServer):
def get_base_url(self, ip_addr=None):
addr, port = self.server_address
if port != 80:
port = f":{port}"
if ip_addr is not None:
addr = ip_addr
protocol = "https" if type(self.socket) == ssl.SSLSocket else "http"
if (int(port) == 80 and protocol == "http") or (int(port) == 443 and protocol == "https"):
port = ""
return f"{protocol}://{addr}{port}"
def get_full_url(self, uri, ip_addr=None):