about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--main.py9
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'<h1>' + b'UwU ' * 2000 + b'</h1>'