diff options
| author | UltraQbik <no1skill@yandex.ru> | 2024-08-20 02:21:57 +0300 |
|---|---|---|
| committer | UltraQbik <no1skill@yandex.ru> | 2024-08-20 02:21:57 +0300 |
| commit | d68322bdab4c90e4a887300cd1460f286e34d565 (patch) | |
| tree | f7db0c3d5af77eccc71e724099c9a7e83460f258 /main.py | |
| parent | 3182c192dc35cf0561d7608f65867da39ad9538c (diff) | |
| download | httpy-d68322bdab4c90e4a887300cd1460f286e34d565.tar.gz httpy-d68322bdab4c90e4a887300cd1460f286e34d565.zip | |
Path length check
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 9 |
1 files changed, 7 insertions, 2 deletions
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'<h1>' + b'UwU ' * 2000 + b'</h1>' |