"Fix img url parsing"

This commit is contained in:
2021-03-24 17:20:40 +01:00
parent d14252f707
commit 7639383782
3 changed files with 16 additions and 10 deletions

View File

@@ -177,6 +177,7 @@ def get_headers(client: HTTPSocket):
return result
def parse_headers(lines):
headers = []
# first header after the status-line may not contain a space
@@ -210,6 +211,7 @@ def parse_headers(lines):
return result
def check_next_header(headers, next_header: str, next_value: str):
if next_header == "content-length":
if "content-length" in headers:
@@ -229,8 +231,11 @@ def parse_uri(uri: str):
path = parsed.path
if parsed.query != '':
path = f"{path}?{parsed.query}"
else:
elif "/" in uri:
(host, path) = uri.split("/", 1)
else:
host = uri
path = "/"
if ":" in host:
host, port = host.split(":", 1)