From d68322bdab4c90e4a887300cd1460f286e34d565 Mon Sep 17 00:00:00 2001 From: UltraQbik Date: Tue, 20 Aug 2024 02:21:57 +0300 Subject: Path length check --- .gitignore | 2 ++ main.py | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7b6caf3..9a9ce1f 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,5 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ +/cert.pem +/key.pem diff --git a/main.py b/main.py index deb3f74..4078d99 100644 --- a/main.py +++ b/main.py @@ -173,13 +173,18 @@ class HTMLServer: self.clients.remove(client) async def handle_get_request(self, client: socket.socket, req: dict[str, str | None]): + # check if the path is too long + if len(req["path"]) > 255: + response = get_response(400) + data = b'' + # if it's yandex - if req.get("from") == "support@search.yandex.ru": + elif req.get("from") == "support@search.yandex.ru": response = get_response(404) data = b'Nothing...' # check UwU path - elif req["path"] == "/UwU" or req["path"] == "/U/w/U": + elif req["path"] == "/UwU": response = get_response(6969) data = b'

' + b'UwU ' * 2000 + b'

' -- cgit 1.4.1