A quick fix
This commit is contained in:
11
pywebsrv.py
11
pywebsrv.py
@@ -41,7 +41,7 @@ class FileHandler:
|
|||||||
DEFAULT_CONFIG = (
|
DEFAULT_CONFIG = (
|
||||||
"port:8080\nport-https:8443\nhttp:1"
|
"port:8080\nport-https:8443\nhttp:1"
|
||||||
"\nhttps:0\ndirectory:{cwd}\nhost:localhost"
|
"\nhttps:0\ndirectory:{cwd}\nhost:localhost"
|
||||||
"allow-ip:1\nallow-localhost:1"
|
"allow-all:1\nallow-localhost:1"
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, base_dir=None):
|
def __init__(self, base_dir=None):
|
||||||
@@ -122,6 +122,9 @@ class FileHandler:
|
|||||||
or option == "allow-localhost"
|
or option == "allow-localhost"
|
||||||
or option == "disable-autocertgen"
|
or option == "disable-autocertgen"
|
||||||
):
|
):
|
||||||
|
print(
|
||||||
|
f"option: {option}, val: {value}, ret: {bool(int(value))}"
|
||||||
|
)
|
||||||
return bool(int(value))
|
return bool(int(value))
|
||||||
return value
|
return value
|
||||||
return None
|
return None
|
||||||
@@ -177,10 +180,8 @@ class RequestParser:
|
|||||||
host = host.split(":", 1)[0]
|
host = host.split(":", 1)[0]
|
||||||
host = host.lstrip()
|
host = host.lstrip()
|
||||||
if (
|
if (
|
||||||
host == "localhost"
|
host == "localhost" or host == "127.0.0.1"
|
||||||
or host == "127.0.0.1"
|
) and self.file_handler.read_config("allow-localhost"):
|
||||||
and bool(self.file_handler.read_config("allow-localhost")) is True
|
|
||||||
):
|
|
||||||
return True
|
return True
|
||||||
if host not in self.hosts and self.all_allowed is False:
|
if host not in self.hosts and self.all_allowed is False:
|
||||||
return False
|
return False
|
||||||
|
Reference in New Issue
Block a user