"Fix img url parsing"
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user