server: add commands

This commit is contained in:
2021-03-25 16:43:39 +01:00
parent edfdc94747
commit b37aa33131
3 changed files with 100 additions and 14 deletions

View File

@@ -93,7 +93,7 @@ class RequestHandler:
else:
path = self.root + target
mime = mimetypes.guess_type(path)[0]
if mime.startswith("test"):
if mime.startswith("text"):
file = open(path, "rb", FORMAT)
else:
file = open(path, "rb")
@@ -104,7 +104,7 @@ class RequestHandler:
message += date + "\r\n"
if mime:
message += f"Content-Type: {mime}"
if mime.startswith("test"):
if mime.startswith("text"):
message += "; charset=UTF-8"
message += "\r\n"
message += f"Content-Length: {len(buffer)}\r\n"